diff --git a/packages/shared-components/.storybook/preview.tsx b/packages/shared-components/.storybook/preview.tsx index 52e7fd8b6c..0c423aedd9 100644 --- a/packages/shared-components/.storybook/preview.tsx +++ b/packages/shared-components/.storybook/preview.tsx @@ -6,6 +6,7 @@ import React, { useLayoutEffect } from "react"; import { setLanguage } from "../src/utils/i18n"; import { TooltipProvider } from "@vector-im/compound-web"; import { StoryContext } from "storybook/internal/csf"; +import { I18nApi, I18nContext } from "../src"; export const globalTypes = { theme: { @@ -64,9 +65,11 @@ async function languageLoader(context: StoryContext): const withTooltipProvider: Decorator = (Story) => { return ( - - - + + + + + ); }; diff --git a/packages/shared-components/src/audio/AudioPlayerView/AudioPlayerView.stories.tsx b/packages/shared-components/src/audio/AudioPlayerView/AudioPlayerView.stories.tsx index 496d2408cd..18782f25cb 100644 --- a/packages/shared-components/src/audio/AudioPlayerView/AudioPlayerView.stories.tsx +++ b/packages/shared-components/src/audio/AudioPlayerView/AudioPlayerView.stories.tsx @@ -11,8 +11,6 @@ import { fn } from "storybook/test"; import type { Meta, StoryFn } from "@storybook/react-vite"; import { AudioPlayerView, type AudioPlayerViewActions, type AudioPlayerViewSnapshot } from "./AudioPlayerView"; import { useMockedViewModel } from "../../useMockedViewModel"; -import { I18nContext } from "../../utils/i18nContext"; -import { I18nApi } from "../../utils/I18nApi"; type AudioPlayerProps = AudioPlayerViewSnapshot & AudioPlayerViewActions; const AudioPlayerViewWrapper = ({ togglePlay, onKeyDown, onSeekbarChange, ...rest }: AudioPlayerProps): JSX.Element => { @@ -21,11 +19,7 @@ const AudioPlayerViewWrapper = ({ togglePlay, onKeyDown, onSeekbarChange, ...res onKeyDown, onSeekbarChange, }); - return ( - - - - ); + return ; }; export default { diff --git a/packages/shared-components/src/audio/Clock/Clock.stories.tsx b/packages/shared-components/src/audio/Clock/Clock.stories.tsx index 44a214e487..e05ee086d9 100644 --- a/packages/shared-components/src/audio/Clock/Clock.stories.tsx +++ b/packages/shared-components/src/audio/Clock/Clock.stories.tsx @@ -9,8 +9,6 @@ import React from "react"; import type { Meta, StoryFn } from "@storybook/react-vite"; import { Clock } from "./Clock"; -import { I18nContext } from "../../utils/i18nContext"; -import { I18nApi } from "../../utils/I18nApi"; export default { title: "Audio/Clock", @@ -21,13 +19,7 @@ export default { }, } as Meta; -const Template: StoryFn = (args) => { - return ( - - - - ); -}; +const Template: StoryFn = (args) => ; export const Default = Template.bind({}); diff --git a/packages/shared-components/src/audio/PlayPauseButton/PlayPauseButton.stories.tsx b/packages/shared-components/src/audio/PlayPauseButton/PlayPauseButton.stories.tsx index f399020b0f..5bbcfbbf39 100644 --- a/packages/shared-components/src/audio/PlayPauseButton/PlayPauseButton.stories.tsx +++ b/packages/shared-components/src/audio/PlayPauseButton/PlayPauseButton.stories.tsx @@ -5,13 +5,10 @@ * Please see LICENSE files in the repository root for full details. */ -import React from "react"; import { fn } from "storybook/test"; import { PlayPauseButton } from "./PlayPauseButton"; -import type { Meta, StoryFn } from "@storybook/react-vite"; -import { I18nContext } from "../../utils/i18nContext"; -import { I18nApi } from "../.."; +import type { Meta, StoryObj } from "@storybook/react-vite"; const meta = { title: "Audio/PlayPauseButton", @@ -23,17 +20,7 @@ const meta = { } satisfies Meta; export default meta; +type Story = StoryObj; -const Template: StoryFn = (args) => { - return ( - - - - ); -}; - -export const Default = Template.bind({}); -export const Playing = Template.bind({}); -Playing.args = { - playing: true, -}; +export const Default: Story = {}; +export const Playing: Story = { args: { playing: true } }; diff --git a/packages/shared-components/src/audio/SeekBar/SeekBar.stories.tsx b/packages/shared-components/src/audio/SeekBar/SeekBar.stories.tsx index f6a2c7397f..6a3ec48666 100644 --- a/packages/shared-components/src/audio/SeekBar/SeekBar.stories.tsx +++ b/packages/shared-components/src/audio/SeekBar/SeekBar.stories.tsx @@ -10,7 +10,6 @@ import { useArgs } from "storybook/preview-api"; import { SeekBar } from "./SeekBar"; import type { Meta, StoryFn } from "@storybook/react-vite"; -import { I18nApi, I18nContext } from "../.."; export default { title: "Audio/SeekBar", @@ -28,11 +27,7 @@ export default { const Template: StoryFn = (args) => { const [, updateArgs] = useArgs(); - return ( - - updateArgs({ value: parseInt(evt.target.value, 10) })} {...args} /> - - ); + return updateArgs({ value: parseInt(evt.target.value, 10) })} {...args} />; }; export const Default = Template.bind({}); diff --git a/packages/shared-components/src/pill-input/Pill/Pill.stories.tsx b/packages/shared-components/src/pill-input/Pill/Pill.stories.tsx index 6e9bf32a3b..ef6b1a3cff 100644 --- a/packages/shared-components/src/pill-input/Pill/Pill.stories.tsx +++ b/packages/shared-components/src/pill-input/Pill/Pill.stories.tsx @@ -8,9 +8,8 @@ import React from "react"; import { fn } from "storybook/test"; -import type { Meta, StoryFn } from "@storybook/react-vite"; +import type { Meta, StoryObj } from "@storybook/react-vite"; import { Pill } from "./Pill"; -import { I18nApi, I18nContext } from "../.."; const meta = { title: "PillInput/Pill", @@ -24,17 +23,7 @@ const meta = { } satisfies Meta; export default meta; +type Story = StoryObj; -const Template: StoryFn = (args) => { - return ( - - - - ); -}; - -export const Default = Template.bind({}); -export const WithoutCloseButton = Template.bind({}); -WithoutCloseButton.args = { - onClick: undefined, -}; +export const Default: Story = {}; +export const WithoutCloseButton: Story = {}; diff --git a/packages/shared-components/src/rich-list/RichItem/RichItem.stories.tsx b/packages/shared-components/src/rich-list/RichItem/RichItem.stories.tsx index 835395ef00..309579cd3b 100644 --- a/packages/shared-components/src/rich-list/RichItem/RichItem.stories.tsx +++ b/packages/shared-components/src/rich-list/RichItem/RichItem.stories.tsx @@ -37,11 +37,9 @@ export default { } as Meta; const Template: StoryFn = (args) => ( - -
    - -
-
+
    + +
); export const Default = Template.bind({}); @@ -60,11 +58,9 @@ export const Hover = Template.bind({}); Hover.parameters = { pseudo: { hover: true } }; const TemplateSeparator: StoryFn = (args) => ( - -
    - - -
-
+
    + + +
); export const Separator = TemplateSeparator.bind({}); diff --git a/packages/shared-components/src/rich-list/RichList/RichList.stories.tsx b/packages/shared-components/src/rich-list/RichList/RichList.stories.tsx index d6c3c53c0d..e4a9406e71 100644 --- a/packages/shared-components/src/rich-list/RichList/RichList.stories.tsx +++ b/packages/shared-components/src/rich-list/RichList/RichList.stories.tsx @@ -8,9 +8,8 @@ import React from "react"; import { RichList } from "./RichList"; -import type { Meta, StoryFn } from "@storybook/react-vite"; +import type { Meta, StoryObj } from "@storybook/react-vite"; import { RichItem } from "../RichItem"; -import { I18nApi, I18nContext } from "../.."; const avatar =
; @@ -40,18 +39,12 @@ const meta = { } satisfies Meta; export default meta; +type Story = StoryObj; -const Template: StoryFn = (args) => { - return ( - - - - ); -}; - -export const Default = Template.bind({}); -export const Empty = Template.bind({}); -Empty.args = { - isEmpty: true, - children: "No items available", +export const Default: Story = {}; +export const Empty: Story = { + args: { + isEmpty: true, + children: "No items available", + }, };