diff --git a/packages/ui-components/src/index.ts b/packages/ui-components/src/index.ts index f7ded3fe6..c6c655a52 100644 --- a/packages/ui-components/src/index.ts +++ b/packages/ui-components/src/index.ts @@ -15,6 +15,7 @@ export * from './ui/checkbox'; export * from './ui/collapsible'; export * from './ui/color-picker'; export * from './ui/command'; +export * from './ui/composing-card'; export * from './ui/context-menu'; export * from './ui/data-table'; export * from './ui/data-table-column-header'; diff --git a/packages/ui-components/src/stories/composing-card.stories.tsx b/packages/ui-components/src/stories/composing-card.stories.tsx new file mode 100644 index 000000000..10aea966c --- /dev/null +++ b/packages/ui-components/src/stories/composing-card.stories.tsx @@ -0,0 +1,44 @@ +import type { Meta, StoryObj } from '@storybook/react'; + +import { ComposingCard } from '@/ui/composing-card'; +import { ThemeAwareDecorator } from '../../.storybook/decorators'; + +/** + * A responsive card wrapper that accepts children and supports transparent or solid background. + */ +const meta = { + title: 'ui/ComposingCard', + component: ComposingCard, + tags: ['autodocs'], + args: { + className: 'w-96 p-6', + transparent: false, + }, + render: (args) => ( + +

Card content goes here.

+
+ ), + parameters: { + layout: 'centered', + }, + decorators: [ThemeAwareDecorator], +} satisfies Meta; + +export default meta; + +type Story = StoryObj; + +/** + * Default card with the component's solid background. + */ +export const Default: Story = {}; + +/** + * Card with transparent background. + */ +export const Transparent: Story = { + args: { + transparent: true, + }, +}; diff --git a/packages/ui-components/src/ui/composing-card.tsx b/packages/ui-components/src/ui/composing-card.tsx new file mode 100644 index 000000000..85ec404b6 --- /dev/null +++ b/packages/ui-components/src/ui/composing-card.tsx @@ -0,0 +1,29 @@ +import * as React from 'react'; + +import { cn } from '../lib/cn'; + +type ComposingCardProps = React.HTMLAttributes & { + transparent?: boolean; +}; + +const ComposingCard = React.forwardRef( + ({ className, transparent = false, children, ...props }, ref) => ( +
+ {children} +
+ ), +); +ComposingCard.displayName = 'ComposingCard'; + +export { ComposingCard };