diff --git a/packages/ui/src/stories/switch.stories.tsx b/packages/ui/src/stories/switch.stories.tsx new file mode 100644 index 0000000..956abc9 --- /dev/null +++ b/packages/ui/src/stories/switch.stories.tsx @@ -0,0 +1,41 @@ +import type { Meta, StoryObj } from '@storybook/react'; +import { fn } from '@storybook/test'; +import { Switch } from '../switch'; +import { Label } from '../label'; + +const meta = { + title: 'Coderum/Switch', + component: Switch, + parameters: { + layout: 'centered', + }, + tags: ['autodocs'], + argTypes: {}, + args: { + disabled: false, + onChange: fn(), + }, +} satisfies Meta; + +export default meta; +type Story = StoryObj; + +export const Checked: Story = {}; + +export const WithLabel: Story = { + render: (args) => ( +
+ + +
+ ), +}; + +export const Disabled: Story = { + args: { + disabled: true, + }, +}; diff --git a/packages/ui/src/styles/tailwind.css b/packages/ui/src/styles/tailwind.css index 1e1a794..311c1e6 100644 --- a/packages/ui/src/styles/tailwind.css +++ b/packages/ui/src/styles/tailwind.css @@ -820,6 +820,12 @@ body { margin-bottom: calc(0.5rem * var(--tw-space-y-reverse)); } +.space-x-2 > :not([hidden]) ~ :not([hidden]) { + --tw-space-x-reverse: 0; + margin-right: calc(0.5rem * var(--tw-space-x-reverse)); + margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse))); +} + .overflow-hidden { overflow: hidden; }