import type { Meta, StoryObj } from '@storybook/react' import { Code } from '@/components/ui/code' const meta = { title: 'Primitives/Code', component: Code, tags: ['autodocs'], parameters: { layout: 'centered' }, argTypes: { variant: { control: 'select', options: ['inline', 'block'], }, language: { control: 'text' }, }, } satisfies Meta export default meta type Story = StoryObj export const Inline: Story = { args: { variant: 'inline', children: 'pnpm install', }, } export const InlineInSentence: Story = { render: () => (

To get started, run pnpm install and then{' '} pnpm dev to start the development server on{' '} localhost:3000.

), } export const Block: Story = { args: { variant: 'block', language: 'bash', children: `pnpm install pnpm dev pnpm build`, }, } export const BlockLongCommand: Story = { args: { variant: 'block', language: 'bash', children: 'curl -fsSL https://example.com/install.sh | bash -s -- --prefix=/usr/local --no-color --very-long-flag-that-should-wrap', }, } export const BlockTypescript: Story = { args: { variant: 'block', language: 'ts', children: `import { Code } from '@/components/ui/code' export function Example() { return Hello, world! }`, }, } export const AllVariants: Story = { render: () => (

Inline

Use cn() from @/lib/utils to merge Tailwind classes.

Block

{`# install and run pnpm install pnpm dev`}
), }