-
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.
feat: List Component Storybook (#3509)
- Loading branch information
Showing
2 changed files
with
51 additions
and
1 deletion.
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
50 changes: 50 additions & 0 deletions
50
editor.planx.uk/src/@planx/components/List/Public/List.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,50 @@ | ||
import { Meta, StoryObj } from "@storybook/react"; | ||
import React from "react"; | ||
|
||
import Wrapper from "../../fixtures/Wrapper"; | ||
import { SCHEMAS } from "../Editor"; | ||
import Editor from "../Editor"; | ||
import ListComponent from "../Public"; | ||
import Public from "./"; | ||
|
||
const meta = { | ||
title: "PlanX Components/List", | ||
component: ListComponent, | ||
} satisfies Meta<typeof ListComponent>; | ||
|
||
type SchemaItem = (typeof SCHEMAS)[number]; | ||
type SchemaNames = SchemaItem["name"]; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
const schemaFinder = (name: SchemaNames) => { | ||
const schemaObj = SCHEMAS.find((schema) => schema.name === name)?.schema; | ||
return schemaObj || SCHEMAS[0].schema; | ||
}; | ||
|
||
export const Basic: Story = { | ||
args: { | ||
title: | ||
"Describe any residential units that are being removed or lost as part of the development", | ||
description: "Add one or many units below", | ||
schemaName: "Residential units (GLA) - Removed", | ||
fn: "MockFn", | ||
schema: schemaFinder("Residential units (GLA) - Removed"), | ||
}, | ||
}; | ||
|
||
export const SingularItem: Story = { | ||
args: { | ||
title: "Describe the advertisements you want to add", | ||
description: "Complete the questions below", | ||
schemaName: "Proposed advertisements", | ||
fn: "MockFn", | ||
schema: schemaFinder("Proposed advertisements"), | ||
}, | ||
}; | ||
|
||
export const WithEditor = () => { | ||
return <Wrapper Editor={Editor} Public={Public} />; | ||
}; |