-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9e12e61
commit 3e382c3
Showing
7 changed files
with
112 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,5 +10,7 @@ | |
} | ||
}, | ||
"type": "module", | ||
"dependencies": {} | ||
"dependencies": { | ||
"csstype": "^3.1.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import * as radius from './radius'; | ||
import { Palette, RadiusSwatch as Swatch } from '../.storybook/components'; | ||
|
||
const meta: Meta = { | ||
title: 'Radius', | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj; | ||
|
||
export const Zero: Story = { | ||
render: () => <Swatch style={{ borderRadius: radius.zero }} />, | ||
name: 'zero', | ||
}; | ||
|
||
export const Xs: Story = { | ||
render: () => <Swatch style={{ borderRadius: radius.xs }} />, | ||
name: 'xs', | ||
}; | ||
|
||
export const Sm: Story = { | ||
render: () => <Swatch style={{ borderRadius: radius.sm }} />, | ||
name: 'sm', | ||
}; | ||
|
||
export const Md: Story = { | ||
render: () => <Swatch style={{ borderRadius: radius.md }} />, | ||
name: 'md', | ||
}; | ||
|
||
export const Lg: Story = { | ||
render: () => <Swatch style={{ borderRadius: radius.lg }} />, | ||
name: 'lg', | ||
}; | ||
|
||
export const Xl: Story = { | ||
render: () => <Swatch style={{ borderRadius: radius.xl }} />, | ||
name: 'xl', | ||
}; | ||
|
||
export const Full: Story = { | ||
render: () => <Swatch style={{ borderRadius: radius.full }} />, | ||
name: 'full', | ||
}; | ||
|
||
export const Radius: Story = { | ||
render: () => ( | ||
<Palette> | ||
{Object.entries(radius.radius).map(([name, value]) => ( | ||
<div key={name}> | ||
<div>{name}</div> | ||
<Swatch style={{ borderRadius: value }} /> | ||
</div> | ||
))} | ||
</Palette> | ||
), | ||
name: 'radius (palette)', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import type { Property } from 'csstype'; | ||
|
||
/** A global token for a CSS border radius property value. */ | ||
export type RadiusToken = Property.BorderRadius; | ||
|
||
export const zero = '0px' as const satisfies RadiusToken; | ||
export const xs = '2px' as const satisfies RadiusToken; | ||
export const sm = '4px' as const satisfies RadiusToken; | ||
export const md = '8px' as const satisfies RadiusToken; | ||
export const lg = '16px' as const satisfies RadiusToken; | ||
export const xl = '32px' as const satisfies RadiusToken; | ||
export const full = '9999px' as const satisfies RadiusToken; | ||
|
||
/** A palette of radius tokens. */ | ||
export type RadiusPalette = Record<string, RadiusToken>; | ||
|
||
export const radius = { | ||
zero, | ||
xs, | ||
sm, | ||
md, | ||
lg, | ||
xl, | ||
full, | ||
} as const satisfies RadiusPalette; |