-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(stories): update stories to version 7 format
- Loading branch information
Ben Protheroe
committed
May 23, 2023
1 parent
92568fa
commit 737509a
Showing
11 changed files
with
163 additions
and
148 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,23 +1,25 @@ | ||
import React from "react"; | ||
import { ComponentStory, ComponentMeta } from "@storybook/react"; | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
|
||
import AnalyticsDecorator from "../../storybook-decorators/AnalyticsDecorator"; | ||
import { MenuProvider } from "../../context/Menu"; | ||
|
||
import Component from "./AppHeader"; | ||
|
||
export default { | ||
const meta: Meta<typeof Component> = { | ||
title: "Headers & Footers/App Header", | ||
decorators: [AnalyticsDecorator], | ||
component: Component, | ||
argTypes: {}, | ||
} as ComponentMeta<typeof Component>; | ||
}; | ||
|
||
const Template: ComponentStory<typeof Component> = (args) => ( | ||
<MenuProvider> | ||
<Component {...args} /> | ||
</MenuProvider> | ||
); | ||
export default meta; | ||
type Story = StoryObj<typeof Component>; | ||
|
||
export const AppHeader = Template.bind({}); | ||
AppHeader.args = {}; | ||
export const Flex: Story = { | ||
args: {}, | ||
render: (args) => ( | ||
<MenuProvider> | ||
<Component {...args} /> | ||
</MenuProvider> | ||
), | ||
}; |
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 |
---|---|---|
@@ -1,33 +1,34 @@ | ||
import { ComponentStory, ComponentMeta } from "@storybook/react"; | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import { OverlayProvider } from "react-aria"; | ||
|
||
import Component from "."; | ||
|
||
export default { | ||
const meta: Meta<typeof Component> = { | ||
title: "Lists/BioCardList", | ||
component: Component, | ||
} as ComponentMeta<typeof Component>; | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof Component>; | ||
|
||
const Template: ComponentStory<typeof Component> = (args) => { | ||
return ( | ||
export const BioCardList: Story = { | ||
args: { | ||
bios: [ | ||
"Jack", | ||
"Joe", | ||
"Craig", | ||
"Verity", | ||
"Mitch", | ||
"Tomas", | ||
"Jim", | ||
"Ross", | ||
"Ian", | ||
"Matt", | ||
].map((name, i) => ({ name, id: String(i), role: "Worker" })), | ||
}, | ||
render: (args) => ( | ||
<OverlayProvider> | ||
<Component {...args} /> | ||
</OverlayProvider> | ||
); | ||
}; | ||
|
||
export const BioCardList = Template.bind({}); | ||
BioCardList.args = { | ||
bios: [ | ||
"Jack", | ||
"Joe", | ||
"Craig", | ||
"Verity", | ||
"Mitch", | ||
"Tomas", | ||
"Jim", | ||
"Ross", | ||
"Ian", | ||
"Matt", | ||
].map((name, i) => ({ name, id: String(i), role: "Worker" })), | ||
), | ||
}; |
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
73 changes: 37 additions & 36 deletions
73
src/components/Filters/CategoryFilterList/CategoryFilterList.stories.tsx
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 |
---|---|---|
@@ -1,47 +1,48 @@ | ||
import { ComponentStory, ComponentMeta } from "@storybook/react"; | ||
import { Meta, StoryObj } from "@storybook/react"; | ||
|
||
import { BlogListingLinkProps } from "../../../common-lib/urls"; | ||
import AnalyticsDecorator from "../../../storybook-decorators/AnalyticsDecorator"; | ||
|
||
import useCategoryFilterList from "./useCategoryFilterList"; | ||
|
||
import Component from "."; | ||
|
||
export default { | ||
const meta: Meta<typeof Component> = { | ||
title: "Filters/Category Filter List", | ||
decorators: [AnalyticsDecorator], | ||
component: Component, | ||
} as ComponentMeta<typeof Component>; | ||
|
||
const Template: ComponentStory<typeof Component> = (args) => { | ||
const props = useCategoryFilterList<BlogListingLinkProps>({ | ||
selectedKey: "oak-updates", | ||
getKey: (link) => link.category, | ||
}); | ||
// Can't get storybook types to play nicely with generic component | ||
// eslint-disable-next-line | ||
// @ts-ignore | ||
return <Component<BlogListingLinkProps> {...args} {...props} />; | ||
}; | ||
|
||
export const CategoryFilterList = Template.bind({}); | ||
CategoryFilterList.args = { | ||
categories: [ | ||
{ | ||
linkProps: { page: "blog-index", category: "oak-updates" }, | ||
label: "Oak updates", | ||
}, | ||
{ | ||
linkProps: { page: "blog-index", category: "lesson-planning" }, | ||
label: "Lesson planning", | ||
}, | ||
{ | ||
linkProps: { page: "blog-index", category: "teaching-learning" }, | ||
label: "Teaching and learning", | ||
}, | ||
{ | ||
linkProps: { page: "blog-index", category: "research" }, | ||
label: "Research and insights", | ||
}, | ||
], | ||
export default meta; | ||
type Story = StoryObj<typeof Component>; | ||
|
||
export const CategoryFilterList: Story = { | ||
args: { | ||
categories: [ | ||
{ | ||
linkProps: { page: "blog-index", category: "" }, | ||
label: "Oak updates", | ||
}, | ||
{ | ||
linkProps: { page: "blog-index", category: "lesson-planning" }, | ||
label: "Lesson planning", | ||
}, | ||
{ | ||
linkProps: { page: "blog-index", category: "teaching-learning" }, | ||
label: "Teaching and learning", | ||
}, | ||
{ | ||
linkProps: { page: "blog-index", category: "research" }, | ||
label: "Research and insights", | ||
}, | ||
], | ||
}, | ||
render: (args) => { | ||
// get functionality working | ||
// const { getIsSelected, setSelected } = useCategoryFilterList({ | ||
// selectedKey: 'lesson-planning', | ||
// getKey: (linkProps: BlogListingLinkProps | WebinarListingLinkProps) => | ||
// linkProps.category || null, | ||
// }); | ||
return ( | ||
<Component {...args} /> | ||
); | ||
}, | ||
}; |
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
31 changes: 17 additions & 14 deletions
31
src/components/Filters/LearningThemeFilters/LearningThemeFilters.stories.tsx
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 |
---|---|---|
@@ -1,26 +1,29 @@ | ||
import { ComponentStory, ComponentMeta } from "@storybook/react"; | ||
import { Meta, StoryObj } from "@storybook/react"; | ||
|
||
import AnalyticsDecorator from "../../../storybook-decorators/AnalyticsDecorator"; | ||
|
||
import Component from "."; | ||
|
||
export default { | ||
const meta: Meta<typeof Component> = { | ||
title: "Filters/Category Filter List/LearningThemeFilters", | ||
decorators: [AnalyticsDecorator], | ||
component: Component, | ||
} as ComponentMeta<typeof Component>; | ||
|
||
const Template: ComponentStory<typeof Component> = (args) => { | ||
return <Component {...args} />; | ||
}; | ||
|
||
export const LearningThemeFilters = Template.bind({}); | ||
LearningThemeFilters.args = { | ||
selectedThemeSlug: "some-theme", | ||
learningThemes: [], | ||
linkProps: { | ||
page: "unit-index", | ||
viewType: "teachers", | ||
programme: "some-programme", | ||
export default meta; | ||
type Story = StoryObj<typeof Component>; | ||
|
||
export const LearningThemeFilters: Story = { | ||
args: { | ||
selectedThemeSlug: "some-theme", | ||
learningThemes: [], | ||
linkProps: { | ||
page: "unit-index", | ||
viewType: "teachers", | ||
programme: "some-programme", | ||
}, | ||
}, | ||
render: (args) => { | ||
return <Component {...args} />; | ||
}, | ||
}; |
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 |
---|---|---|
@@ -1,29 +1,32 @@ | ||
import { ComponentStory, ComponentMeta } from "@storybook/react"; | ||
import { Meta, StoryObj } from "@storybook/react"; | ||
|
||
import AnalyticsDecorator from "../../storybook-decorators/AnalyticsDecorator"; | ||
import keyStageKeypad from "../../browser-lib/fixtures/keyStageKeypad"; | ||
import Flex from "../Flex"; | ||
|
||
import Component from "./KeyStageKeypad"; | ||
|
||
export default { | ||
const meta: Meta<typeof Component> = { | ||
title: "Navigation", | ||
decorators: [AnalyticsDecorator], | ||
component: Component, | ||
argTypes: {}, | ||
} as ComponentMeta<typeof Component>; | ||
}; | ||
|
||
const Template: ComponentStory<typeof Component> = () => { | ||
return ( | ||
<Flex $flexDirection={"column"} $pa={16}> | ||
<Flex $background={"pupilsLightGreen"} $pa={16} $mb={12}> | ||
<Component {...keyStageKeypad} /> | ||
</Flex> | ||
<Flex $background={"pupilsLightGreen"} $pa={16} $mb={12}> | ||
<Component keyStages={keyStageKeypad.keyStages} /> | ||
export default meta; | ||
type Story = StoryObj<typeof Component>; | ||
|
||
export const KeyStageKeypad: Story = { | ||
render: () => { | ||
return ( | ||
<Flex $flexDirection={"column"} $pa={16}> | ||
<Flex $background={"pupilsLightGreen"} $pa={16} $mb={12}> | ||
<Component {...keyStageKeypad} /> | ||
</Flex> | ||
<Flex $background={"pupilsLightGreen"} $pa={16} $mb={12}> | ||
<Component keyStages={keyStageKeypad.keyStages} /> | ||
</Flex> | ||
</Flex> | ||
</Flex> | ||
); | ||
); | ||
}, | ||
}; | ||
|
||
export const KeyStageKeypad = Template.bind({}); |
Oops, something went wrong.