-
Notifications
You must be signed in to change notification settings - Fork 16
Feat/skeleton component #231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
90f13fd
e618d3a
c95c3ef
9b52568
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export { default as Skeleton } from "./skeleton"; | ||
| export * from "./skeleton"; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| import React from "react"; | ||
| import type { Meta, StoryObj } from "@storybook/react-vite"; | ||
| import Skeleton from "./skeleton"; | ||
|
|
||
| const meta: Meta<typeof Skeleton> = { | ||
| title: "Components/Skeleton", | ||
| component: Skeleton, | ||
| parameters: { docs: { source: { type: "dynamic" } }, layout: "centered" }, | ||
| decorators: [ | ||
| (Story) => ( | ||
| <div | ||
| style={{ | ||
| display: "grid", | ||
| gridTemplateColumns: "1fr 1fr", | ||
| gap: "2rem", | ||
| width: "500px", | ||
| }} | ||
| > | ||
| <Story /> | ||
| </div> | ||
| ), | ||
| ], | ||
| argTypes: { | ||
| className: { | ||
| control: "text", | ||
| description: "Custom CSS classes for sizing and styling.", | ||
| }, | ||
| }, | ||
| tags: ["autodocs"], | ||
| }; | ||
|
|
||
| export default meta; | ||
| type Story = StoryObj<typeof Skeleton>; | ||
|
|
||
| export const Default: Story = { | ||
| render: () => ( | ||
| <Skeleton className="w-full h-8 shrink-0 rounded-4xl mx-auto" /> | ||
aakash19here marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ), | ||
| }; | ||
|
|
||
| export const Avatar: Story = { | ||
| render: () => ( | ||
| <> | ||
| <div className="text-center"> | ||
| <div className="flex w-fit items-center gap-4"> | ||
| <Skeleton className="size-10 shrink-0 rounded-full" /> | ||
| <div className="grid gap-2"> | ||
| <Skeleton className="h-4 w-[150px]" /> | ||
| <Skeleton className="h-4 w-[100px]" /> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </> | ||
| ), | ||
| }; | ||
|
|
||
| export const Card: Story = { | ||
| render: () => ( | ||
| <div className="w-[300px] border border-gray-500/10 dark:border-gray-400 gap-4 overflow-hidden rounded-xl py-4 flex flex-col"> | ||
| <div className="gap-1 px-4 space-y-2 w-full"> | ||
| <Skeleton className="h-4 w-11/12" /> | ||
| <Skeleton className="h-4 w-1/3" /> | ||
| </div> | ||
| <div className="px-4"> | ||
| <Skeleton className="aspect-video w-full" /> | ||
| </div> | ||
| </div> | ||
| ), | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import React from "react"; | ||
|
|
||
| const Skeleton = ({ className, ...props }: React.ComponentProps<"div">) => { | ||
| return ( | ||
| <div | ||
| data-slot="skeleton" | ||
| className={`bg-surface-gray-3 dark:bg-surface-gray-4 rounded-md animate-pulse ${className}`} | ||
| {...props} | ||
| /> | ||
| ); | ||
| }; | ||
|
|
||
| export default Skeleton; |
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -0,0 +1,50 @@ | ||||
| import React from "react"; | ||||
|
||||
| import React from "react"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without the react import the ts compiler throws this error 'React' refers to a UMD global, but the current file is a module. Consider adding an import instead.ts(2686) even though ts config has jsx property to be react-jsx
Uh oh!
There was an error while loading. Please reload this page.