import { Meta, StoryObj } from '@storybook/react-webpack5'; import Body from '../../Body'; import Title from '../../Title'; import Container from '../Container'; import { createSandboxStory, globalScope, } from '../../../.storybook/components/sandbox/SandboxEditor'; export default { component: Container, title: 'Layout/Container', tags: ['early-access'], argTypes: { size: { control: 'radio', options: ['fluid', 'standard', 'narrow', 'compact'], }, as: { control: 'text' }, className: { table: { category: 'Common' } }, }, args: { size: 'standard', as: undefined, className: undefined, }, parameters: { docs: { toc: true }, padding: '0', }, } satisfies Meta; type Story = StoryObj; const sizeLabels = { fluid: 'Fluid', standard: 'Standard', narrow: 'Narrow', compact: 'Compact', } as const; const sizeMaxWidths = { fluid: '100%', standard: '1160px', narrow: '840px', compact: '600px', } as const; const sizeDescriptions = { fluid: 'Fills the full available width with no maximum constraint.', standard: 'Constrains content to 1160px — the default for most page layouts.', narrow: 'Constrains content to 840px, suited for reading-focused or form layouts.', compact: 'Constrains content to 600px, ideal for single-column or focused content.', } as const; /** Explore size and element type via the controls panel. */ export const Playground: Story = { decorators: [ (Story, { args }) => (
), ], render: (args) => ( <> {sizeLabels[args.size ?? 'standard']} container {sizeDescriptions[args.size ?? 'standard']} ), }; export const Sandbox = createSandboxStory({ code: ` Page content This content is constrained by the Container width. `, scope: globalScope, }); /** * Four sizes control the maximum width of the container.
* `fluid` fills the full viewport, `standard` caps at 1160px, `narrow` at 840px, and `compact` at * 600px. */ export const Size: Story = { argTypes: { size: { table: { disable: true } }, as: { table: { disable: true } }, className: { table: { disable: true } }, }, render: () => (
{(['fluid', 'standard', 'narrow', 'compact'] as const).map((size) => (
{sizeLabels[size]} Max width: {sizeMaxWidths[size]}
))}
), parameters: { docs: { source: { code: ` Fluid Max width: 100% Standard Max width: 1160px Narrow Max width: 840px Compact Max width: 600px `, }, }, }, };