diff --git a/src/stories/Spacing.stories.tsx b/src/stories/Spacing.stories.tsx new file mode 100644 index 000000000..9ebf45ff7 --- /dev/null +++ b/src/stories/Spacing.stories.tsx @@ -0,0 +1,62 @@ +import type { Meta, StoryObj } from '@storybook/react'; + +import { Box } from '../ui/Box'; +import { Flex } from '../ui/Flex'; +import { Stack } from '../ui/Stack'; +import { Text } from '../ui/Text'; +import { theme } from '../ui/theme/theme'; + +const SpacingDemo = ({ space, value }: { space: string; value: string }) => ( + + + + + {space} + + {value} + + +); + +const SpacingShowcase = () => ( + + + Theme Spacing + + {Object.entries(theme.space).map(([space, value]) => ( + + ))} + +); + +const meta = { + title: 'Theme/Spacing', + component: SpacingShowcase, + parameters: { + layout: 'padded', + docs: { + source: { + code: ` + // Example SpacingDemo for spacing 4. See w={4} + + + + + 4 + + 1rem + + + `, + language: 'tsx', + type: 'auto', + }, + }, + }, + tags: ['autodocs'], +} satisfies Meta; + +export default meta; +type Story = StoryObj; + +export const AllSpacing: Story = {}; diff --git a/src/ui/theme/theme.ts b/src/ui/theme/theme.ts index 11ac96f10..564bc6e93 100644 --- a/src/ui/theme/theme.ts +++ b/src/ui/theme/theme.ts @@ -116,7 +116,19 @@ export const theme = extendTheme({ 4.5: '1.125rem', }, space: { + 0: '0px', + 1: '0.25rem', // 4px + 2: '0.5rem', // 8px + 3: '0.75rem', // 12px + 4: '1rem', // 16px 4.5: '1.125rem', + 5: '1.25rem', // 20px + 6: '1.5rem', // 24px + 8: '2rem', // 32px + 10: '2.5rem', // 40px + 12: '3rem', // 48px + 16: '4rem', // 64px + 18: '4.5rem', // 72px }, borders: { '1px': '1px solid var(--stacks-colors-borderPrimary)',