diff --git a/src/components/AppHeader/AppHeader.stories.tsx b/src/components/AppHeader/AppHeader.stories.tsx index ae92205716..eae52bc388 100644 --- a/src/components/AppHeader/AppHeader.stories.tsx +++ b/src/components/AppHeader/AppHeader.stories.tsx @@ -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 = { title: "Headers & Footers/App Header", decorators: [AnalyticsDecorator], component: Component, argTypes: {}, -} as ComponentMeta; +}; -const Template: ComponentStory = (args) => ( - - - -); +export default meta; +type Story = StoryObj; -export const AppHeader = Template.bind({}); -AppHeader.args = {}; +export const Flex: Story = { + args: {}, + render: (args) => ( + + + + ), +}; diff --git a/src/components/BioCardList/BioCardList.stories.tsx b/src/components/BioCardList/BioCardList.stories.tsx index b7d11d0c1d..39b184ef90 100644 --- a/src/components/BioCardList/BioCardList.stories.tsx +++ b/src/components/BioCardList/BioCardList.stories.tsx @@ -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 = { title: "Lists/BioCardList", component: Component, -} as ComponentMeta; +}; + +export default meta; +type Story = StoryObj; -const Template: ComponentStory = (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) => ( - ); -}; - -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" })), + ), }; diff --git a/src/components/DownloadComponents/DownloadCard/DownloadCard.stories.tsx b/src/components/DownloadComponents/DownloadCard/DownloadCard.stories.tsx index 8025223e78..ec1139f6ec 100644 --- a/src/components/DownloadComponents/DownloadCard/DownloadCard.stories.tsx +++ b/src/components/DownloadComponents/DownloadCard/DownloadCard.stories.tsx @@ -1,15 +1,13 @@ -import React, { useState } from "react"; -import { ComponentStory, ComponentMeta } from "@storybook/react"; +import type { Meta, StoryObj } from "@storybook/react"; +import { action } from "@storybook/addon-actions"; +import React from "react"; import Component from "."; -export default { +const meta: Meta = { title: "Download Components/Download Card", component: Component, argTypes: { - title: { - defaultValue: "Click me", - }, id: { defaultValue: "1", }, @@ -23,16 +21,18 @@ export default { defaultValue: "presentation", }, }, -} as ComponentMeta; - -const Template: ComponentStory = (args) => { - const [value, setValue] = useState(false); - return ( - setValue(!value)} /> - ); }; -export const Checkbox = Template.bind({}); -Checkbox.args = { - extension: "pdf", +export default meta; +type Story = StoryObj; + +export const Checkbox: Story = { + args: { + extension: "pdf", + checked: false, + onChange: action("changed"), + }, + render: (args) => { + return ; + }, }; diff --git a/src/components/ExpandingContainer/ExpandingContainer.stories.tsx b/src/components/ExpandingContainer/ExpandingContainer.stories.tsx index c89a2f10a9..ef7ed79680 100644 --- a/src/components/ExpandingContainer/ExpandingContainer.stories.tsx +++ b/src/components/ExpandingContainer/ExpandingContainer.stories.tsx @@ -1,11 +1,12 @@ -import { ComponentStory, ComponentMeta } from "@storybook/react"; +import type { Meta, StoryObj } from "@storybook/react"; import AnalyticsDecorator from "../../storybook-decorators/AnalyticsDecorator"; import Card from "../Card"; import Component from "."; -export default { + +const meta: Meta = { title: "Foundations/ExpandingContainer", component: Component, decorators: [AnalyticsDecorator, (Story) => ], @@ -22,20 +23,20 @@ export default { // projetable:{defaultValue, true}, // downloadable:{defaultValue, true}, }, -} as ComponentMeta; - -const Template: ComponentStory = (args) => ( - -); +}; -export const ExpandingContainer = Template.bind({}); +export default meta; +type Story = StoryObj; -ExpandingContainer.args = { - external: true, - projectable: true, - downloadable: true, - title: "Video", - programmeSlug: "secondary-ks3-maths", - unitSlug: "unit", - lessonSlug: "slug-slug-slug", +export const ExpandingContainer: Story = { + args: { + external: true, + projectable: true, + downloadable: true, + title: "Video", + programmeSlug: "secondary-ks3-maths", + unitSlug: "unit", + lessonSlug: "slug-slug-slug", + }, + render: (args) => , }; diff --git a/src/components/Filters/CategoryFilterList/CategoryFilterList.stories.tsx b/src/components/Filters/CategoryFilterList/CategoryFilterList.stories.tsx index 1132edf384..8061e0212c 100644 --- a/src/components/Filters/CategoryFilterList/CategoryFilterList.stories.tsx +++ b/src/components/Filters/CategoryFilterList/CategoryFilterList.stories.tsx @@ -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 = { title: "Filters/Category Filter List", decorators: [AnalyticsDecorator], component: Component, -} as ComponentMeta; - -const Template: ComponentStory = (args) => { - const props = useCategoryFilterList({ - 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 {...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; + +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 ( + + ); + }, }; diff --git a/src/components/Filters/CategoryFilterList/CategoryFilterList.tsx b/src/components/Filters/CategoryFilterList/CategoryFilterList.tsx index 2eca50938b..3ca99480f7 100644 --- a/src/components/Filters/CategoryFilterList/CategoryFilterList.tsx +++ b/src/components/Filters/CategoryFilterList/CategoryFilterList.tsx @@ -27,6 +27,7 @@ const CategoryFilterList = ( ...boxProps } = props; + console.log("CategoryFilterList", categories); return (