From cd1aef9ef03f8caf4d4cecc2076d3c4d20349456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dafydd=20Ll=C5=B7r=20Pearson?= Date: Mon, 16 Sep 2024 14:43:31 +0100 Subject: [PATCH] feat(page): Add Storybook file --- .../@planx/components/Page/Page.stories.tsx | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 editor.planx.uk/src/@planx/components/Page/Page.stories.tsx diff --git a/editor.planx.uk/src/@planx/components/Page/Page.stories.tsx b/editor.planx.uk/src/@planx/components/Page/Page.stories.tsx new file mode 100644 index 0000000000..cc92e8dd21 --- /dev/null +++ b/editor.planx.uk/src/@planx/components/Page/Page.stories.tsx @@ -0,0 +1,38 @@ +import { Meta, StoryObj } from "@storybook/react"; +import React from "react"; + +import Wrapper from "../fixtures/Wrapper"; +import Editor, { PAGE_SCHEMAS } from "./Editor"; +import Public from "./Public"; + +const meta = { + title: "PlanX Components/Page", + component: Public, +} satisfies Meta; + +type SchemaItem = (typeof PAGE_SCHEMAS)[number]; +type SchemaNames = SchemaItem["name"]; + +export default meta; + +type Story = StoryObj; + +const schemaFinder = (name: SchemaNames) => { + const schemaObj = PAGE_SCHEMAS.find((schema) => schema.name === name)?.schema; + return schemaObj || PAGE_SCHEMAS[0].schema; +}; + +export const Basic: Story = { + args: { + title: + "Tell us about your proposed advertisements", + description: "Please add your details below", + schemaName: "Advert consent", + fn: "MockFn", + schema: schemaFinder("Advert consent"), + }, +}; + +export const WithEditor = () => { + return ; +};