-
s
+
+
s
-
+
-
m
+
m
-
+
-
l
+
l
-
+
-
xl
+
xl
-
+
diff --git a/src/components/RadioGroup/__stories__/Docs.mdx b/src/components/RadioGroup/__stories__/Docs.mdx
new file mode 100644
index 0000000000..2d19ce12ad
--- /dev/null
+++ b/src/components/RadioGroup/__stories__/Docs.mdx
@@ -0,0 +1,7 @@
+import {Meta, Markdown} from '@storybook/addon-docs';
+import * as Stories from './RadioGroup.stories';
+import Readme from '../README.md?raw';
+
+
+
+
{Readme}
diff --git a/src/components/RadioGroup/__stories__/RadioGroup.stories.tsx b/src/components/RadioGroup/__stories__/RadioGroup.stories.tsx
index 3107441c6a..65b9868bc0 100644
--- a/src/components/RadioGroup/__stories__/RadioGroup.stories.tsx
+++ b/src/components/RadioGroup/__stories__/RadioGroup.stories.tsx
@@ -1,10 +1,10 @@
import React from 'react';
-import type {Meta, StoryFn} from '@storybook/react';
+import type {Meta, StoryObj} from '@storybook/react';
+import {Showcase} from '../../../demo/Showcase';
import {ShowcaseItem} from '../../../demo/ShowcaseItem';
import {RadioGroup} from '../RadioGroup';
-import type {RadioGroupOption, RadioGroupProps} from '../RadioGroup';
import {RadioGroupShowcase} from './RadioGroupShowcase';
@@ -13,51 +13,60 @@ export default {
component: RadioGroup,
} as Meta;
-const options: RadioGroupOption[] = [
- {value: 'Value 1', content: 'Value 1'},
- {value: 'Value 2', content: 'Value 2'},
- {value: 'Value 3', content: 'Value 3'},
-];
+type Story = StoryObj
;
-const DefaultTemplate: StoryFn = (args) => {
- const [value, setValue] = React.useState(options[0].value);
- return ;
-};
-export const Default = DefaultTemplate.bind({});
-Default.args = {
- options,
+export const Default: Story = {
+ args: {
+ options: [
+ {value: 'Value 1', content: 'Value 1'},
+ {value: 'Value 2', content: 'Value 2'},
+ {value: 'Value 3', content: 'Value 3'},
+ ],
+ },
};
-export const Direction: StoryFn = (args) => {
- const [value, setValue] = React.useState(args.options?.[0].value);
-
- return (
-
-
-
+export const Size: Story = {
+ render: (args) => (
+
+
+
-
-
+
+
-
- );
+
+ ),
+ args: {
+ ...Default.args,
+ },
};
-Direction.args = {
- options,
+
+export const Disabled: Story = {
+ args: {
+ ...Default.args,
+ disabled: true,
+ },
};
-const ShowcaseTemplate: StoryFn = () => ;
-export const Showcase = ShowcaseTemplate.bind({});
+export const Direction: Story = {
+ args: {
+ ...Default.args,
+ },
+ render: (args) => {
+ return (
+
+
+
+
+
+
+
+
+ );
+ },
+};
+
+export const ShowcaseStory: Story = {
+ render: () => ,
+ name: 'Showcase',
+};
diff --git a/src/components/RadioGroup/__stories__/RadioGroupShowcase.tsx b/src/components/RadioGroup/__stories__/RadioGroupShowcase.tsx
index 34dd1376a6..8d2c41ae7f 100644
--- a/src/components/RadioGroup/__stories__/RadioGroupShowcase.tsx
+++ b/src/components/RadioGroup/__stories__/RadioGroupShowcase.tsx
@@ -12,7 +12,7 @@ export function RadioGroupShowcase() {
{value: 'Value 3', content: 'Value 3', disabled: true},
];
return (
-
+
diff --git a/src/components/Switch/__stories__/Docs.mdx b/src/components/Switch/__stories__/Docs.mdx
new file mode 100644
index 0000000000..285917560e
--- /dev/null
+++ b/src/components/Switch/__stories__/Docs.mdx
@@ -0,0 +1,7 @@
+import {Meta, Markdown} from '@storybook/addon-docs';
+import * as Stories from './Switch.stories';
+import Readme from '../README.md?raw';
+
+
+
+{Readme}
diff --git a/src/components/Switch/__stories__/Switch.stories.tsx b/src/components/Switch/__stories__/Switch.stories.tsx
index cb5f498f65..d4a941d454 100644
--- a/src/components/Switch/__stories__/Switch.stories.tsx
+++ b/src/components/Switch/__stories__/Switch.stories.tsx
@@ -1,9 +1,9 @@
import React from 'react';
-import type {Meta, StoryFn} from '@storybook/react';
+import type {Meta, StoryObj} from '@storybook/react';
+import {Showcase} from '../../../demo/Showcase';
import {Switch} from '../Switch';
-import type {SwitchProps} from '../Switch';
import {SwitchShowcase} from './SwitchShowcase';
@@ -12,53 +12,48 @@ export default {
component: Switch,
} as Meta;
-const DefaultTemplate: StoryFn = (args) => ;
-export const Default = DefaultTemplate.bind({});
-
-const SizeTemplate: StoryFn = (args) => (
-
- m:
-
- l:
-
-);
-export const Size = SizeTemplate.bind({});
-
-const DisabledTemplate: StoryFn = (args) => (
-
-
-
-
-
-);
-export const Disabled = DisabledTemplate.bind({});
-
-const LabelTemplate: StoryFn = (args) => (
-
-
-
-
-
-
-
- Full
- width
- content
-
+type Story = StoryObj;
+
+export const Default: Story = {
+ args: {
+ content: 'Label',
+ },
+};
+
+export const Checked: Story = {
+ args: {
+ ...Default.args,
+ checked: true,
+ },
+};
+
+export const Size: Story = {
+ render: (args) => (
+
+
+ Size m
-
-
-);
-export const Label = LabelTemplate.bind({});
-
-const ControlledTemplate: StoryFn = (args) => (
-
-
-
-
-
-);
-export const Controlled = ControlledTemplate.bind({});
-
-const ShowcaseTemplate: StoryFn = () => ;
-export const Showcase = ShowcaseTemplate.bind({});
+
+ Size l
+
+
+ ),
+};
+
+export const Disabled: Story = {
+ render: (args) => (
+
+
+ Unchecked
+
+
+ Checked
+
+
+ ),
+};
+
+export const ShowcaseStory: Story = {
+ render: () => ,
+ name: 'Showcase',
+};
diff --git a/src/components/Switch/__stories__/SwitchShowcase.scss b/src/components/Switch/__stories__/SwitchShowcase.scss
deleted file mode 100644
index 891ecfb4af..0000000000
--- a/src/components/Switch/__stories__/SwitchShowcase.scss
+++ /dev/null
@@ -1,7 +0,0 @@
-.switch-showcase {
- margin: 36px;
-
- .row {
- margin-bottom: 16px;
- }
-}
diff --git a/src/components/Switch/__stories__/SwitchShowcase.tsx b/src/components/Switch/__stories__/SwitchShowcase.tsx
index 4d9d2cba1a..ee294868e9 100644
--- a/src/components/Switch/__stories__/SwitchShowcase.tsx
+++ b/src/components/Switch/__stories__/SwitchShowcase.tsx
@@ -4,11 +4,9 @@ import {Showcase} from '../../../demo/Showcase';
import {ShowcaseItem} from '../../../demo/ShowcaseItem';
import {Switch} from '../Switch';
-import './SwitchShowcase.scss';
-
export const SwitchShowcase = () => {
return (
-
+
diff --git a/src/demo/Showcase/Showcase.scss b/src/demo/Showcase/Showcase.scss
index 5c30e2d753..434d4343ab 100644
--- a/src/demo/Showcase/Showcase.scss
+++ b/src/demo/Showcase/Showcase.scss
@@ -9,12 +9,19 @@
}
&__description {
- @include mixins.text-body-3();
- margin-top: 10px;
+ @include mixins.text-body-2();
+ margin-top: var(--g-spacing-2);
+ color: var(--g-color-text-secondary);
}
&__content {
flex-grow: 1;
- margin-top: 20px;
+ display: flex;
+ flex-wrap: wrap;
+ gap: var(--g-spacing-6);
+
+ &:not(:only-child) {
+ margin-top: var(--g-spacing-5);
+ }
}
}
diff --git a/src/demo/Showcase/Showcase.tsx b/src/demo/Showcase/Showcase.tsx
index d50070224a..486c70ccf0 100644
--- a/src/demo/Showcase/Showcase.tsx
+++ b/src/demo/Showcase/Showcase.tsx
@@ -5,7 +5,7 @@ import {cn} from '../../components/utils/cn';
import './Showcase.scss';
type Props = React.PropsWithChildren<{
- title: string;
+ title?: string;
description?: React.ReactNode;
className?: string;
}>;
@@ -15,8 +15,8 @@ const b = cn('showcase');
export function Showcase({title, description, className, children}: Props) {
return (
-
{title}
-
{description}
+ {title &&
{title}
}
+ {description &&
{description}
}
{children}
);
diff --git a/src/demo/ShowcaseItem/ShowcaseItem.scss b/src/demo/ShowcaseItem/ShowcaseItem.scss
index cd84773591..6b4f9e2385 100644
--- a/src/demo/ShowcaseItem/ShowcaseItem.scss
+++ b/src/demo/ShowcaseItem/ShowcaseItem.scss
@@ -1,12 +1,8 @@
-.showcase-item {
- display: inline-block;
- margin-right: 60px;
- margin-bottom: 20px;
- vertical-align: top;
+@use '../../../styles/mixins';
+.showcase-item {
&__title {
- font-size: 16px;
- font-weight: bold;
- margin-bottom: 15px;
+ @include mixins.text-subheader-3();
+ margin-bottom: var(--g-spacing-3);
}
}
diff --git a/src/demo/StoryLayout/StoryLayout.scss b/src/demo/StoryLayout/StoryLayout.scss
deleted file mode 100644
index 3904d117c7..0000000000
--- a/src/demo/StoryLayout/StoryLayout.scss
+++ /dev/null
@@ -1,5 +0,0 @@
-.story-layout {
- display: flex;
- flex-wrap: wrap;
- gap: 1rem;
-}
diff --git a/src/demo/StoryLayout/StoryLayout.tsx b/src/demo/StoryLayout/StoryLayout.tsx
deleted file mode 100644
index 6f35f98d4b..0000000000
--- a/src/demo/StoryLayout/StoryLayout.tsx
+++ /dev/null
@@ -1,21 +0,0 @@
-import React from 'react';
-
-import {cn} from '../../components/utils/cn';
-
-import './StoryLayout.scss';
-
-export interface StoryLayoutProps extends React.PropsWithChildren {}
-
-const b = cn('story-layout');
-
-export function StoryLayout({children}: StoryLayoutProps) {
- return (
-
- {React.Children.map(children, (elem, i) => (
-
- {elem}
-
- ))}
-
- );
-}