Skip to content

Commit

Permalink
feat: add Card component (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
totraev authored Jan 16, 2025
1 parent 70f1efe commit a7b3785
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/moody-dryers-doubt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@babylonlabs-io/bbn-core-ui": minor
---

add Card component
3 changes: 3 additions & 0 deletions src/components/Card/Card.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.bbn-card {
@apply rounded border border-primary-dark/20 bg-secondary-contrast p-6;
}
16 changes: 16 additions & 0 deletions src/components/Card/Card.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { Meta, StoryObj } from "@storybook/react";

import { Card } from "./Card";

const meta: Meta<typeof Card> = {
component: Card,
tags: ["autodocs"],
};

export default meta;

type Story = StoryObj<typeof meta>;

export const Default: Story = {
args: { children: "Card" },
};
12 changes: 12 additions & 0 deletions src/components/Card/Card.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { type PropsWithChildren, createElement } from "react";
import { twJoin } from "tailwind-merge";
import "./Card.css";

interface CardProps extends PropsWithChildren {
as?: string;
className?: string;
}

export function Card({ as = "div", className, children }: CardProps) {
return createElement(as, { className: twJoin("bbn-card", className) }, children);
}
1 change: 1 addition & 0 deletions src/components/Card/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Card } from "./Card";
1 change: 1 addition & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export * from "./components/Portal";
export * from "./components/Loader";
export * from "./components/Table";
export * from "./components/Popover";
export * from "./components/Card";

export * from "./widgets/form/Form";
export * from "./widgets/form/NumberField";
Expand Down

0 comments on commit a7b3785

Please sign in to comment.