From 05aa972995a9003dd9ed3bea03f6eb5f8a7c01b9 Mon Sep 17 00:00:00 2001 From: jipstavenuiter Date: Thu, 16 Mar 2023 19:59:40 +0200 Subject: [PATCH 1/8] split up stories between raidguild and client theme --- .gitignore | 6 +++ .storybook/preview.js | 5 --- src/components/atoms/Tag/Tag.tsx | 4 +- src/index.ts | 2 +- src/stories/atoms/Accordion.stories.tsx | 32 ++++++++++++++-- src/stories/atoms/Badge.stories.tsx | 33 ++++++++++++++-- src/stories/atoms/Button.stories.tsx | 35 +++++++++++++++-- src/stories/atoms/Card.stories.tsx | 37 ++++++++++++++++-- src/stories/atoms/DatePicker.stories.tsx | 35 +++++++++++++++-- src/stories/atoms/Heading.stories.tsx | 36 ++++++++++++++++-- src/stories/atoms/List.stories.tsx | 35 +++++++++++++++-- src/stories/atoms/Menu.stories.tsx | 32 ++++++++++++++-- src/stories/atoms/Spinner.stories.tsx | 32 ++++++++++++++-- src/stories/atoms/Tabs.stories.tsx | 26 +++++++++++-- src/stories/atoms/Tag.stories.tsx | 36 ++++++++++++++++-- src/stories/atoms/Text.stories.tsx | 36 +++++++++++++++--- src/stories/atoms/Toast.stories.tsx | 28 ++++++++++++-- src/stories/atoms/Tooltip.stories.tsx | 32 ++++++++++++++-- src/stories/constants.ts | 0 src/stories/index-client.stories.tsx | 48 ++++++++++++++++++++++++ src/theme/index.ts | 2 + 21 files changed, 471 insertions(+), 61 deletions(-) create mode 100644 src/stories/constants.ts create mode 100644 src/stories/index-client.stories.tsx diff --git a/.gitignore b/.gitignore index d9a9232..fafea2a 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,9 @@ dist storybook-static/* .yarn .yarnrc.yml +/.idea/inspectionProfiles/Project_Default.xml +/.idea/.gitignore +/.idea/design-system.iml +/.idea/modules.xml +/.idea/vcs.xml +/.idea/prettier.xml diff --git a/.storybook/preview.js b/.storybook/preview.js index 4e0213d..b33f135 100644 --- a/.storybook/preview.js +++ b/.storybook/preview.js @@ -1,6 +1,4 @@ import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport'; -import { themes } from '@storybook/theming'; -import theme from '../src/theme/index'; import { Fonts, Box } from '../src'; export const parameters = { @@ -15,9 +13,6 @@ export const parameters = { // sets the execution mode for the addon manual: false, }, - chakra: { - theme, - }, controls: { expanded: true, matchers: { diff --git a/src/components/atoms/Tag/Tag.tsx b/src/components/atoms/Tag/Tag.tsx index 8dbf99c..1b0eb0d 100644 --- a/src/components/atoms/Tag/Tag.tsx +++ b/src/components/atoms/Tag/Tag.tsx @@ -1,9 +1,9 @@ import React from 'react'; import { ChakraTag, ChakraTagProps } from '../../chakra'; -interface CustomTagProps { +type CustomTagProps = { label?: string; -} +}; export type TagProps = CustomTagProps & ChakraTagProps; diff --git a/src/index.ts b/src/index.ts index bbdadf7..2c9e7bd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -24,4 +24,4 @@ export { default as RGThemeProvider, Fonts, } from './components/RGThemeProvider'; -export { default as defaultTheme } from './theme'; +export { default as defaultTheme, clientTheme } from './theme'; diff --git a/src/stories/atoms/Accordion.stories.tsx b/src/stories/atoms/Accordion.stories.tsx index 2e3d38f..aa7dd93 100644 --- a/src/stories/atoms/Accordion.stories.tsx +++ b/src/stories/atoms/Accordion.stories.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Meta, StoryFn } from '@storybook/react'; +import { Meta, StoryObj } from '@storybook/react'; import { Accordion as AccordionComponent, AccordionItem, @@ -8,17 +8,25 @@ import { AccordionIcon, Text, Heading, + defaultTheme, + clientTheme, } from '../..'; export default { title: 'Components/Atoms/Accordion', component: AccordionComponent, + parameters: { + chakra: { + theme: defaultTheme, + }, + }, } as Meta; +type Story = StoryObj; // eslint-disable-next-line max-len // TODO this could be abstracted to its own component, but just added the style to the default chakra component for now -const Accordion: StoryFn = () => ( +const AccordionStoryContent = () => ( @@ -41,4 +49,22 @@ const Accordion: StoryFn = () => ( ); -export { Accordion }; +export const Guild: Story = { + render: () => , + name: 'RaidGuild', + parameters: { + chakra: { + theme: defaultTheme, + }, + }, +}; + +export const Client: Story = { + render: () => , + name: 'ClientTheme', + parameters: { + chakra: { + theme: clientTheme, + }, + }, +}; diff --git a/src/stories/atoms/Badge.stories.tsx b/src/stories/atoms/Badge.stories.tsx index 4be52b8..10d2add 100644 --- a/src/stories/atoms/Badge.stories.tsx +++ b/src/stories/atoms/Badge.stories.tsx @@ -1,11 +1,18 @@ import React from 'react'; -import { Meta, StoryFn } from '@storybook/react'; -import { Badge as BadgeComponent, Stack, HStack } from '../..'; +import { Meta, StoryObj } from '@storybook/react'; +import { + Badge as BadgeComponent, + Stack, + HStack, + defaultTheme, + clientTheme, +} from '../..'; export default { title: 'Components/Atoms/Badge', component: BadgeComponent, } as Meta; +type Story = StoryObj; const badgeColors = [ { name: 'Default', color: 'gray' }, @@ -16,7 +23,7 @@ const badgeColors = [ const badgeVariants = ['outline', 'solid', 'subtle']; -const Badge: StoryFn = () => ( +const BadgeStoryContent = () => ( {badgeColors.map((b) => ( @@ -34,4 +41,22 @@ const Badge: StoryFn = () => ( ); -export { Badge }; +export const Guild: Story = { + render: () => , + name: 'RaidGuild', + parameters: { + chakra: { + theme: defaultTheme, + }, + }, +}; + +export const Client: Story = { + render: () => , + name: 'ClientTheme', + parameters: { + chakra: { + theme: clientTheme, + }, + }, +}; diff --git a/src/stories/atoms/Button.stories.tsx b/src/stories/atoms/Button.stories.tsx index 0348981..3d5b6fa 100644 --- a/src/stories/atoms/Button.stories.tsx +++ b/src/stories/atoms/Button.stories.tsx @@ -1,11 +1,19 @@ import React from 'react'; -import { Meta, StoryFn } from '@storybook/react'; -import { Button as ButtonComponent, Flex, Stack, Text } from '../..'; +import { Meta, StoryObj } from '@storybook/react'; +import { + Button as ButtonComponent, + clientTheme, + defaultTheme, + Flex, + Stack, + Text, +} from '../..'; export default { title: 'Components/Atoms/Buttons', component: ButtonComponent, } as Meta; +type Story = StoryObj; const buttonVariants = [ { name: 'Solid', variant: 'solid' }, @@ -15,7 +23,7 @@ const buttonVariants = [ { name: 'Ghost', variant: 'ghost' }, ]; -const Buttons: StoryFn = () => ( +const ButtonsStoryContent = () => ( {buttonVariants.map((button) => ( @@ -28,4 +36,23 @@ const Buttons: StoryFn = () => ( ); -export { Buttons }; +export const Guild: Story = { + render: () => , + name: 'RaidGuild', + + parameters: { + chakra: { + theme: defaultTheme, + }, + }, +}; + +export const Client: Story = { + render: () => , + name: 'ClientTheme', + parameters: { + chakra: { + theme: clientTheme, + }, + }, +}; diff --git a/src/stories/atoms/Card.stories.tsx b/src/stories/atoms/Card.stories.tsx index 14cca22..e3a0850 100644 --- a/src/stories/atoms/Card.stories.tsx +++ b/src/stories/atoms/Card.stories.tsx @@ -1,6 +1,15 @@ import React from 'react'; -import { Meta, StoryFn } from '@storybook/react'; -import { Card, Image, HStack, SimpleGrid, Heading, Text } from '../..'; +import { Meta, StoryObj } from '@storybook/react'; +import { + Card, + Image, + HStack, + SimpleGrid, + Heading, + Text, + defaultTheme, + clientTheme, +} from '../..'; import imgDesignSprints from '../../assets/images/designsprints.png'; import { RoleBadge } from '../../components/molecules'; @@ -12,6 +21,7 @@ export default { title: 'Components/Atoms/Cards', component: Card, } as Meta; +type Story = StoryObj; const cardVariants = [ 'fullBorder', @@ -26,7 +36,7 @@ const title = 'Card Title'; const cardCopy = 'Lorem ipsum dolor sit amet consectetur, adipisicing elit. Asperiores eius amet quisquam ratione, perspiciatis voluptatem officia.'; -const Cards: StoryFn = () => ( +const CardStoryContent = () => ( = () => ( ); -export { Cards }; +export const Guild: Story = { + render: () => , + name: 'RaidGuild', + + parameters: { + chakra: { + theme: defaultTheme, + }, + }, +}; + +export const Client: Story = { + render: () => , + name: 'ClientTheme', + parameters: { + chakra: { + theme: clientTheme, + }, + }, +}; diff --git a/src/stories/atoms/DatePicker.stories.tsx b/src/stories/atoms/DatePicker.stories.tsx index 87a8e52..c90388e 100644 --- a/src/stories/atoms/DatePicker.stories.tsx +++ b/src/stories/atoms/DatePicker.stories.tsx @@ -1,14 +1,22 @@ import React, { useEffect } from 'react'; import { useForm } from 'react-hook-form'; -import { Meta, StoryFn } from '@storybook/react'; -import { DatePicker as DatePickerComponent, Box, Stack, Text } from '../..'; +import { Meta, StoryObj } from '@storybook/react'; +import { + DatePicker as DatePickerComponent, + Box, + Stack, + Text, + defaultTheme, + clientTheme, +} from '../..'; export default { title: 'Components/Atoms/DatePicker', component: DatePickerComponent, } as Meta; +type Story = StoryObj; -const DatePicker: StoryFn = () => { +const DatePickerStoryContent = () => { const localForm = useForm(); useEffect(() => { localForm.reset({ raidStartDate: new Date() }); @@ -35,4 +43,23 @@ const DatePicker: StoryFn = () => { ); }; -export { DatePicker }; +export const Guild: Story = { + render: () => , + name: 'RaidGuild', + + parameters: { + chakra: { + theme: defaultTheme, + }, + }, +}; + +export const Client: Story = { + render: () => , + name: 'ClientTheme', + parameters: { + chakra: { + theme: clientTheme, + }, + }, +}; diff --git a/src/stories/atoms/Heading.stories.tsx b/src/stories/atoms/Heading.stories.tsx index 8710fcf..7c426a7 100644 --- a/src/stories/atoms/Heading.stories.tsx +++ b/src/stories/atoms/Heading.stories.tsx @@ -1,12 +1,21 @@ -import { Meta, StoryFn } from '@storybook/react'; +import { Meta, StoryObj } from '@storybook/react'; import React from 'react'; -import { Heading as HeadingComponent, Stack, Flex, Text } from '../..'; +import { + Heading as HeadingComponent, + Stack, + Flex, + Text, + HeadingProps, + defaultTheme, + clientTheme, +} from '../..'; import { HeadingVariants } from '../../components/atoms/Heading'; export default { title: 'Components/Atoms/Heading', component: HeadingComponent, } as Meta; +type Story = StoryObj; const headingExamples: Array<{ size: string }> = [ { size: '4xl' }, @@ -22,7 +31,7 @@ const headingVariants: HeadingVariants[] = ['shadow', 'noShadow']; const copy = 'RaidGuild vs Moloch'; -const Heading: StoryFn = (args) => ( +const HeadingStoryContent = (args: HeadingProps) => ( {/* Map out each size */} {headingExamples.map((example) => ( @@ -41,4 +50,23 @@ const Heading: StoryFn = (args) => ( ); -export { Heading }; +export const Guild: Story = { + render: (args) => , + name: 'RaidGuild', + + parameters: { + chakra: { + theme: defaultTheme, + }, + }, +}; + +export const Client: Story = { + render: (args) => , + name: 'ClientTheme', + parameters: { + chakra: { + theme: clientTheme, + }, + }, +}; diff --git a/src/stories/atoms/List.stories.tsx b/src/stories/atoms/List.stories.tsx index c60dfdd..ddb3348 100644 --- a/src/stories/atoms/List.stories.tsx +++ b/src/stories/atoms/List.stories.tsx @@ -1,20 +1,28 @@ import React from 'react'; -import { Meta, StoryFn } from '@storybook/react'; +import { Meta, StoryObj } from '@storybook/react'; import { ListItemProps } from 'components/atoms/List/List'; -import { List as ListComponent, HStack, Stack, Heading } from '../..'; +import { + List as ListComponent, + HStack, + Stack, + Heading, + defaultTheme, + clientTheme, +} from '../..'; import Castle from '../../components/icons/Castle'; export default { title: 'Components/Atoms/List', component: ListComponent, } as Meta; +type Story = StoryObj; type ListEntry = Partial & { name: string; ordered?: boolean; }; -const List: StoryFn = () => { +const ListStoryContent = () => { const listItems = ['lorem ipsum 1', 'lorem ipsum 2', 'lorem ipsum 3']; const listVariants: ListEntry[] = [ @@ -41,4 +49,23 @@ const List: StoryFn = () => { ); }; -export { List }; +export const Guild: Story = { + render: () => , + name: 'RaidGuild', + + parameters: { + chakra: { + theme: defaultTheme, + }, + }, +}; + +export const Client: Story = { + render: () => , + name: 'ClientTheme', + parameters: { + chakra: { + theme: clientTheme, + }, + }, +}; diff --git a/src/stories/atoms/Menu.stories.tsx b/src/stories/atoms/Menu.stories.tsx index 3dde324..8150a3b 100644 --- a/src/stories/atoms/Menu.stories.tsx +++ b/src/stories/atoms/Menu.stories.tsx @@ -1,6 +1,7 @@ -import type { Meta, StoryFn } from '@storybook/react'; +import type { Meta } from '@storybook/react'; import React from 'react'; import { FaCaretDown } from 'react-icons/fa'; +import { StoryObj } from '@storybook/react'; import { Menu as MenuComponent, MenuButton, @@ -9,9 +10,11 @@ import { Text, Flex, Icon, + defaultTheme, + clientTheme, } from '../..'; -export const Menu: StoryFn = () => { +const MenuStoryContent = () => { return ( @@ -27,10 +30,33 @@ export const Menu: StoryFn = () => { ); }; -Menu.args = { +const args = { size: 150, }; export default { title: 'Components/Atoms/Menu', + args, + component: MenuComponent, } as Meta; +type Story = StoryObj; + +export const Guild: Story = { + render: () => , + name: 'RaidGuild', + parameters: { + chakra: { + theme: defaultTheme, + }, + }, +}; + +export const Client: Story = { + render: () => , + name: 'ClientTheme', + parameters: { + chakra: { + theme: clientTheme, + }, + }, +}; diff --git a/src/stories/atoms/Spinner.stories.tsx b/src/stories/atoms/Spinner.stories.tsx index d9af14e..733dd78 100644 --- a/src/stories/atoms/Spinner.stories.tsx +++ b/src/stories/atoms/Spinner.stories.tsx @@ -1,15 +1,21 @@ import React from 'react'; -import { Meta, StoryFn } from '@storybook/react'; -import { Spinner as SpinnerComponent, Stack } from '../..'; +import { Meta, StoryObj } from '@storybook/react'; +import { + clientTheme, + defaultTheme, + Spinner as SpinnerComponent, + Stack, +} from '../..'; export default { title: 'Components/Atoms/Spinner', component: SpinnerComponent, } as Meta; +type Story = StoryObj; const spinnerSizes = ['xs', 'sm', 'md', 'lg', 'xl']; -const Spinner: StoryFn = () => ( +const SpinnerStoryContent = () => ( {spinnerSizes.map((size) => ( @@ -17,4 +23,22 @@ const Spinner: StoryFn = () => ( ); -export { Spinner }; +export const Guild: Story = { + render: () => , + name: 'RaidGuild', + parameters: { + chakra: { + theme: defaultTheme, + }, + }, +}; + +export const Client: Story = { + render: () => , + name: 'ClientTheme', + parameters: { + chakra: { + theme: clientTheme, + }, + }, +}; diff --git a/src/stories/atoms/Tabs.stories.tsx b/src/stories/atoms/Tabs.stories.tsx index 781319a..8160c9c 100644 --- a/src/stories/atoms/Tabs.stories.tsx +++ b/src/stories/atoms/Tabs.stories.tsx @@ -1,19 +1,22 @@ import React from 'react'; -import { Meta, StoryFn } from '@storybook/react'; +import { Meta, StoryObj } from '@storybook/react'; import { Tabs as TabsComponent, Tab, TabList, TabPanels, TabPanel, + clientTheme, + defaultTheme, } from '../..'; export default { title: 'Components/Atoms/Tabs', component: TabsComponent, } as Meta; +type Story = StoryObj; -const Tabs: StoryFn = () => ( +const TabsStoryContent = () => ( Test 1 @@ -25,5 +28,22 @@ const Tabs: StoryFn = () => ( ); +export const Guild: Story = { + render: () => , + name: 'RaidGuild', + parameters: { + chakra: { + theme: defaultTheme, + }, + }, +}; -export { Tabs }; +export const Client: Story = { + render: () => , + name: 'ClientTheme', + parameters: { + chakra: { + theme: clientTheme, + }, + }, +}; diff --git a/src/stories/atoms/Tag.stories.tsx b/src/stories/atoms/Tag.stories.tsx index e5156ee..a9573e0 100644 --- a/src/stories/atoms/Tag.stories.tsx +++ b/src/stories/atoms/Tag.stories.tsx @@ -1,11 +1,20 @@ import React from 'react'; -import { Meta, StoryFn } from '@storybook/react'; -import { Tag as TagComponent, Stack, Text, Heading, Flex } from '../..'; +import { Meta, StoryObj } from '@storybook/react'; +import { + Tag as TagComponent, + Stack, + Text, + Heading, + Flex, + defaultTheme, + clientTheme, +} from '../..'; export default { title: 'Components/Atoms/Tags', component: TagComponent, } as Meta; +type Story = StoryObj; const tagVariants = [ { name: 'Solid', variant: 'solid' }, @@ -19,7 +28,7 @@ const tagSizes = [ { name: 'Large', size: 'lg' }, ]; -const Tags: StoryFn = () => ( +const TagsStoryContent = () => ( {tagSizes.map((size) => ( @@ -45,4 +54,23 @@ const Tags: StoryFn = () => ( ); -export { Tags }; +export const Guild: Story = { + render: () => , + name: 'RaidGuild', + + parameters: { + chakra: { + theme: defaultTheme, + }, + }, +}; + +export const Client: Story = { + render: () => , + name: 'ClientTheme', + parameters: { + chakra: { + theme: clientTheme, + }, + }, +}; diff --git a/src/stories/atoms/Text.stories.tsx b/src/stories/atoms/Text.stories.tsx index 567c39e..9524d30 100644 --- a/src/stories/atoms/Text.stories.tsx +++ b/src/stories/atoms/Text.stories.tsx @@ -1,6 +1,13 @@ -import { Meta, StoryFn } from '@storybook/react'; +import { Meta, StoryObj } from '@storybook/react'; import React from 'react'; -import { Text as TextComponent, Stack, Flex } from '../..'; +import { + Text as TextComponent, + Stack, + Flex, + TextProps, + defaultTheme, + clientTheme, +} from '../..'; export default { title: 'Components/Atoms/Text', @@ -16,7 +23,8 @@ export default { control: { type: 'radio' }, }, }, -} as Meta; +} as Meta; +type Story = StoryObj; const textExamples: Array<{ size: any }> = [ { size: '4xl' }, @@ -30,7 +38,7 @@ const textExamples: Array<{ size: any }> = [ const copy = 'At the table of rounds we lay our swords.'; -const Text: StoryFn = (args) => ( +const TextStoryContent = (args: TextProps) => ( {textExamples.map((text) => ( @@ -45,4 +53,22 @@ const Text: StoryFn = (args) => ( ); -export { Text }; +export const Guild: Story = { + render: (args) => , + name: 'RaidGuild', + parameters: { + chakra: { + theme: defaultTheme, + }, + }, +}; + +export const Client: Story = { + render: (args) => , + name: 'ClientTheme', + parameters: { + chakra: { + theme: clientTheme, + }, + }, +}; diff --git a/src/stories/atoms/Toast.stories.tsx b/src/stories/atoms/Toast.stories.tsx index e411e6f..127d22d 100644 --- a/src/stories/atoms/Toast.stories.tsx +++ b/src/stories/atoms/Toast.stories.tsx @@ -1,19 +1,22 @@ import React from 'react'; -import { Meta, StoryFn } from '@storybook/react'; +import { Meta, StoryObj } from '@storybook/react'; import { Toast as ToastComponent, Button, useToast, Stack, + defaultTheme, ToastProvider, + clientTheme, } from '../..'; export default { title: 'Components/Atoms/Toast', component: ToastComponent, } as Meta; +type Story = StoryObj; -const Toast: StoryFn = () => { +const ToastStoryContent = () => { const toast = useToast(); const clickSuccessToast = () => { @@ -81,4 +84,23 @@ const Toast: StoryFn = () => { ); }; -export { Toast }; +export const Guild: Story = { + render: () => , + name: 'RaidGuild', + + parameters: { + chakra: { + theme: defaultTheme, + }, + }, +}; + +export const Client: Story = { + render: () => , + name: 'ClientTheme', + parameters: { + chakra: { + theme: clientTheme, + }, + }, +}; diff --git a/src/stories/atoms/Tooltip.stories.tsx b/src/stories/atoms/Tooltip.stories.tsx index 7c1607c..973f533 100644 --- a/src/stories/atoms/Tooltip.stories.tsx +++ b/src/stories/atoms/Tooltip.stories.tsx @@ -1,13 +1,19 @@ import React from 'react'; -import { Meta, StoryFn } from '@storybook/react'; -import { Tooltip as TooltipComponent, Button } from '../..'; +import { Meta, StoryObj } from '@storybook/react'; +import { + Tooltip as TooltipComponent, + Button, + defaultTheme, + clientTheme, +} from '../..'; export default { title: 'Components/Atoms/Tooltip', component: TooltipComponent, } as Meta; +type Story = StoryObj; -const Tooltip: StoryFn = () => ( +const TooltipStoryContent = () => ( = () => ( ); -export { Tooltip }; +export const Guild: Story = { + render: () => , + name: 'RaidGuild', + parameters: { + chakra: { + theme: defaultTheme, + }, + }, +}; + +export const Client: Story = { + render: () => , + name: 'ClientTheme', + parameters: { + chakra: { + theme: clientTheme, + }, + }, +}; diff --git a/src/stories/constants.ts b/src/stories/constants.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/stories/index-client.stories.tsx b/src/stories/index-client.stories.tsx new file mode 100644 index 0000000..6b03005 --- /dev/null +++ b/src/stories/index-client.stories.tsx @@ -0,0 +1,48 @@ +import { Meta } from '@storybook/react'; +import type { StoryFn } from '@storybook/react'; +import React from 'react'; + +import { Heading, Stack, Text, Flex, Box } from '..'; + +import castle from '../assets/images/raid-guild-castle.png'; +import FooterSimple from '../components/footers/FooterSimple'; + +export const ClientDesignSystem: StoryFn = () => ( + + + + + + Raid Guild Design Guide + + + Use the navigation on the left to explore existing components built + with Raid Guild styling. + + + + + +); + +export default { + title: 'Client Design System', + component: ClientDesignSystem, + parameters: { + chakra: { + theme: {}, + }, + }, +} as Meta; diff --git a/src/theme/index.ts b/src/theme/index.ts index 5923e53..65a60a8 100644 --- a/src/theme/index.ts +++ b/src/theme/index.ts @@ -90,4 +90,6 @@ const theme = extendTheme({ }, }); +export const clientTheme = extendTheme({}); + export default theme; From 063ebd71d6a2d44ae8ff6bee6c8285f7bd8826d6 Mon Sep 17 00:00:00 2001 From: jipstavenuiter Date: Mon, 20 Mar 2023 09:00:02 +0200 Subject: [PATCH 2/8] rewrite all molecule stories to separate themes --- .../molecules/RoleBadge/RoleBadge.tsx | 2 +- src/components/molecules/RoleBadge/index.tsx | 2 +- src/stories/molecules/AlertDialog.stories.tsx | 27 ++++++- .../molecules/BuiltByRaidGuild.stories.tsx | 32 +++++++-- src/stories/molecules/ButtonGroup.stories.tsx | 71 +++++++++++++++---- src/stories/molecules/Modal.stories.tsx | 28 +++++++- src/stories/molecules/RoleBadge.stories.tsx | 38 ++++++++-- .../molecules/SectionTitle.stories.tsx | 36 ++++++++-- 8 files changed, 198 insertions(+), 38 deletions(-) diff --git a/src/components/molecules/RoleBadge/RoleBadge.tsx b/src/components/molecules/RoleBadge/RoleBadge.tsx index ba66568..a860077 100644 --- a/src/components/molecules/RoleBadge/RoleBadge.tsx +++ b/src/components/molecules/RoleBadge/RoleBadge.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { Flex } from '../../chakra'; import { roleImage } from './roleImages'; -interface RoleBadgeProps { +export interface RoleBadgeProps { roleName: string; width?: number | string; height?: number | string; diff --git a/src/components/molecules/RoleBadge/index.tsx b/src/components/molecules/RoleBadge/index.tsx index 19824ec..4e6b333 100644 --- a/src/components/molecules/RoleBadge/index.tsx +++ b/src/components/molecules/RoleBadge/index.tsx @@ -1 +1 @@ -export { default as RoleBadge } from './RoleBadge'; +export { default as RoleBadge, RoleBadgeProps } from './RoleBadge'; diff --git a/src/stories/molecules/AlertDialog.stories.tsx b/src/stories/molecules/AlertDialog.stories.tsx index bed03a6..d641441 100644 --- a/src/stories/molecules/AlertDialog.stories.tsx +++ b/src/stories/molecules/AlertDialog.stories.tsx @@ -1,13 +1,15 @@ import React from 'react'; -import { Meta, StoryFn } from '@storybook/react'; +import { Meta, StoryObj } from '@storybook/react'; import { AlertDialog as AlertDialogComponent, Button, Box, useDisclosure, + defaultTheme, + clientTheme, } from '../..'; -export const AlertDialog: StoryFn = () => { +const AlertDialogStoryContent = () => { const { isOpen, onOpen, onClose } = useDisclosure(); const submit = () => { @@ -33,8 +35,29 @@ export const AlertDialog: StoryFn = () => { ); }; +export const Guild: Story = { + render: () => , + name: 'RaidGuild', + + parameters: { + chakra: { + theme: defaultTheme, + }, + }, +}; + +export const Client: Story = { + render: () => , + name: 'ClientTheme', + parameters: { + chakra: { + theme: clientTheme, + }, + }, +}; export default { title: 'Components/Molecules/Alert Dialog', component: AlertDialogComponent, } as Meta; +type Story = StoryObj; diff --git a/src/stories/molecules/BuiltByRaidGuild.stories.tsx b/src/stories/molecules/BuiltByRaidGuild.stories.tsx index bda71ce..635070b 100644 --- a/src/stories/molecules/BuiltByRaidGuild.stories.tsx +++ b/src/stories/molecules/BuiltByRaidGuild.stories.tsx @@ -1,12 +1,36 @@ -import type { StoryFn } from '@storybook/react'; import React from 'react'; -import { BuiltByRaidGuild as BuiltByRaidGuildComponent } from '../..'; +import { StoryObj } from '@storybook/react'; +import { + BuiltByRaidGuild as BuiltByRaidGuildComponent, + clientTheme, + defaultTheme, +} from '../..'; export default { title: 'Components/Molecules/BuiltByRaidGuild', component: BuiltByRaidGuildComponent, }; +type Story = StoryObj; -const BuiltByRaidGuild: StoryFn = () => ; +const BuiltByRaidGuildStoryContent = () => ; -export { BuiltByRaidGuild }; +export const Guild: Story = { + render: () => , + name: 'RaidGuild', + + parameters: { + chakra: { + theme: defaultTheme, + }, + }, +}; + +export const Client: Story = { + render: () => , + name: 'ClientTheme', + parameters: { + chakra: { + theme: clientTheme, + }, + }, +}; diff --git a/src/stories/molecules/ButtonGroup.stories.tsx b/src/stories/molecules/ButtonGroup.stories.tsx index 4239058..733a525 100644 --- a/src/stories/molecules/ButtonGroup.stories.tsx +++ b/src/stories/molecules/ButtonGroup.stories.tsx @@ -1,36 +1,77 @@ -import type { Meta, StoryFn } from '@storybook/react'; +import type { Meta, StoryFn, StoryObj } from '@storybook/react'; import React from 'react'; -import { ButtonGroup } from '../..'; +import { ButtonGroup, clientTheme, defaultTheme } from '../..'; export default { title: 'Components/Molecules/ButtonGroup', component: ButtonGroup, argTypes: { isAttached: { control: 'boolean' }, - // buttons: { - // options: ['One', 'Two', 'Three', 'Four'], - // control: { type: 'check' }, - // }, spacing: { control: 'number' }, size: { options: ['xs', 'sm', 'md', 'lg'], control: { type: 'radio' } }, }, } as Meta; +type Story = StoryObj; -const Template: StoryFn = ({ +const Template: StoryFn<{ buttons: string[]; isAttached?: boolean }> = ({ buttons, ...args }: { buttons: string[]; }) => null} {...args} />; -export const Attached = Template.bind({}); -Attached.args = { - buttons: ['Tic', 'Tac', 'Toe'], - isAttached: true, +export const GuildAttached: Story = { + render: (args) =>