From 92ebd22e9112823eee4e9c7da8e9cd81341730c0 Mon Sep 17 00:00:00 2001 From: sam-m-m Date: Wed, 28 Apr 2021 12:13:11 -0700 Subject: [PATCH] chore #233 - Add Wizard stories --- src/components/Wizard/Wizard.stories.tsx | 121 +++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 src/components/Wizard/Wizard.stories.tsx diff --git a/src/components/Wizard/Wizard.stories.tsx b/src/components/Wizard/Wizard.stories.tsx new file mode 100644 index 00000000..5fa2e7e5 --- /dev/null +++ b/src/components/Wizard/Wizard.stories.tsx @@ -0,0 +1,121 @@ +import { createUseStyles } from 'react-jss' +import { faArrowLeft, faArrowRight } from '@fortawesome/free-solid-svg-icons' +import { IconButton, IconSizes } from 'components/IconButton' +import { Meta, Story } from '@storybook/react/types-6-0' +import React, { FC, ReactNode } from 'react' +import { styleguide, themedStyles, ThemeType } from '../assets/styles' +import { useWizard, Wizard, WizardProps } from '.' + +const { light, dark } = ThemeType +const { font, spacing } = styleguide + +export default { + argTypes: { + steps: { control: { disable: true } } + }, + component: Wizard, + title: 'Wizard' +} as Meta + +const Template: Story = args => + +const useStyles = createUseStyles({ + container: { + ...font.body, + color: themedStyles[light].base.color, + padding: { left: spacing.s, right: spacing.s } + }, + header: { + ...font.bodyLarge, + borderBottom: `1px solid ${themedStyles[light].base.borderColor}`, + margin: { bottom: spacing.m }, + padding: { bottom: spacing.m, top: spacing.m } + }, + iconArrow: { position: 'absolute' }, + iconLeftArrow: { right: 10 }, + iconRightArrow: { left: 10 }, + title: { position: 'relative', textAlign: 'center' }, + // eslint-disable-next-line sort-keys + '@global': { + [`.${dark}`]: { + '& $container': { + color: themedStyles[dark].base.color + }, + '& $header': { + borderBottom: `1px solid ${themedStyles[dark].base.borderColor}` + } + } + } +}) + +interface Props { + title: ReactNode + content: string +} + +const WizardStep: FC = ({ title, content }: Props) => { + const classes = useStyles() + + return ( +
+
+
{title}
+
+
{content}
+
+ ) +} + +const WizardStepOne = () => { + const classes = useStyles() + const { nextStep } = useWizard() + + return ( + + Foo + nextStep()} + size={IconSizes.xs} + /> + + } + /> + ) +} + +const WizardStepTwo = () => { + const classes = useStyles() + const { prevStep } = useWizard() + + return ( + + Bar + prevStep()} + size={IconSizes.xs} + /> + + } + /> + ) +} + +export const Default = Template.bind({}) +Default.args = { + steps: [ + { render: () => }, + { render: () => } + ] +}