-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(components): add skeleton component
- Loading branch information
1 parent
c658f65
commit ffb0f1d
Showing
4 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { Skeleton } from "./skeleton"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
|
||
import React from "react"; | ||
import { Skeleton } from "./skeleton"; | ||
|
||
const meta: Meta<typeof Skeleton> = { | ||
title: "Skeleton", | ||
component: Skeleton, | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof Skeleton>; | ||
|
||
export const Default: Story = { | ||
render: (args) => <Skeleton {...args} />, | ||
args: { | ||
className: "w-96 h-8", | ||
isAnimated: false, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from "react"; | ||
import { classNames } from "../../util/class-names"; | ||
|
||
export interface SkeletonProps { | ||
className?: string; | ||
isAnimated?: boolean; | ||
} | ||
|
||
export const Skeleton = ({ className, isAnimated = false }: SkeletonProps) => { | ||
return ( | ||
<span | ||
className={classNames( | ||
"block bg-neutral-100 rounded-sm", | ||
isAnimated && "animate-pulse", | ||
className | ||
)} | ||
/> | ||
); | ||
}; |