-
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.
- Loading branch information
1 parent
76c4f9d
commit cd1aef9
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
editor.planx.uk/src/@planx/components/Page/Page.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 |
---|---|---|
@@ -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<typeof Public>; | ||
|
||
type SchemaItem = (typeof PAGE_SCHEMAS)[number]; | ||
type SchemaNames = SchemaItem["name"]; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
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 <Wrapper Editor={Editor} Public={Public} />; | ||
}; |