Skip to content

Commit

Permalink
feat(components): add skeleton component
Browse files Browse the repository at this point in the history
  • Loading branch information
mnlfischer committed Oct 12, 2023
1 parent c658f65 commit ffb0f1d
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ export { Tag } from "./tag";
export { Toast } from "./toast";
export { Toggle } from "./toggle";
export { TopBar } from "./top-bar";
export { Skeleton } from "./skeleton";
1 change: 1 addition & 0 deletions src/components/skeleton/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Skeleton } from "./skeleton";
21 changes: 21 additions & 0 deletions src/components/skeleton/skeleton.stories.tsx
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,
},
};
19 changes: 19 additions & 0 deletions src/components/skeleton/skeleton.tsx
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
)}
/>
);
};

0 comments on commit ffb0f1d

Please sign in to comment.