diff --git a/front/.storybook/preview.ts b/front/.storybook/preview.ts index 3e8cb5654..80b20ded8 100644 --- a/front/.storybook/preview.ts +++ b/front/.storybook/preview.ts @@ -4,7 +4,6 @@ import { ThemeProvider } from '@emotion/react'; import { withThemeFromJSXProvider } from "@storybook/addon-styling"; import { lightTheme, darkTheme } from '../src/modules/ui/layout/styles/themes'; - initialize(); const preview: Preview = { diff --git a/front/src/__stories__/App.darkMode.stories.tsx b/front/src/__stories__/App.darkMode.stories.tsx new file mode 100644 index 000000000..a69016f70 --- /dev/null +++ b/front/src/__stories__/App.darkMode.stories.tsx @@ -0,0 +1,30 @@ +import { Meta } from '@storybook/react'; + +import { App } from '~/App'; +import { graphqlMocks } from '~/testing/graphqlMocks'; +import { mockedUserJWT } from '~/testing/mock-data/jwt'; + +import { Story } from './App.stories'; +import { renderWithDarkMode } from './shared'; + +const meta: Meta = { + title: 'App/App/DarkMode', + component: App, +}; + +export default meta; + +export const DarkMode: Story = { + render: () => renderWithDarkMode(true), + loaders: [ + async () => ({ + accessTokenStored: window.localStorage.setItem( + 'accessToken', + mockedUserJWT, + ), + }), + ], + parameters: { + msw: graphqlMocks, + }, +}; diff --git a/front/src/__stories__/App.mdx b/front/src/__stories__/App.mdx new file mode 100644 index 000000000..f1565e948 --- /dev/null +++ b/front/src/__stories__/App.mdx @@ -0,0 +1,11 @@ +{ /* App.mdx */ } + +import { Canvas, Meta } from '@storybook/blocks'; + +import * as App from './App.stories'; + + + +# App View + + \ No newline at end of file diff --git a/front/src/__stories__/App.stories.tsx b/front/src/__stories__/App.stories.tsx index 36cddc0c2..0173b289b 100644 --- a/front/src/__stories__/App.stories.tsx +++ b/front/src/__stories__/App.stories.tsx @@ -1,14 +1,10 @@ -import { MemoryRouter } from 'react-router-dom'; -import { ApolloProvider } from '@apollo/client'; import type { Meta, StoryObj } from '@storybook/react'; -import { RecoilRoot } from 'recoil'; import { App } from '~/App'; -import { AuthProvider } from '~/providers/AuthProvider'; -import { FullHeightStorybookLayout } from '~/testing/FullHeightStorybookLayout'; import { graphqlMocks } from '~/testing/graphqlMocks'; import { mockedUserJWT } from '~/testing/mock-data/jwt'; -import { mockedClient } from '~/testing/mockedClient'; + +import { render } from './shared'; const meta: Meta = { title: 'App/App', @@ -16,21 +12,7 @@ const meta: Meta = { }; export default meta; -type Story = StoryObj; - -const render = () => ( - - - - - - - - - - - -); +export type Story = StoryObj; export const Default: Story = { render, diff --git a/front/src/__stories__/shared.tsx b/front/src/__stories__/shared.tsx new file mode 100644 index 000000000..de2dfde0a --- /dev/null +++ b/front/src/__stories__/shared.tsx @@ -0,0 +1,36 @@ +import { MemoryRouter } from 'react-router-dom'; +import { ApolloProvider } from '@apollo/client'; +import { ThemeProvider } from '@emotion/react'; +import { RecoilRoot } from 'recoil'; + +import { darkTheme } from '@/ui/layout/styles/themes'; +import { App } from '~/App'; +import { AuthProvider } from '~/providers/AuthProvider'; +import { FullHeightStorybookLayout } from '~/testing/FullHeightStorybookLayout'; +import { mockedClient } from '~/testing/mockedClient'; + +export const render = () => renderWithDarkMode(false); + +export const renderWithDarkMode = (forceDarkMode?: boolean) => { + const AppInStoryBook = ( + + + + + + ); + + return ( + + + + {forceDarkMode ? ( + {AppInStoryBook} + ) : ( + AppInStoryBook + )} + + + + ); +}; diff --git a/front/src/modules/comments/components/__stories__/CommentChip.stories.tsx b/front/src/modules/comments/components/__stories__/CommentChip.stories.tsx index 5dbf67306..5b782da0e 100644 --- a/front/src/modules/comments/components/__stories__/CommentChip.stories.tsx +++ b/front/src/modules/comments/components/__stories__/CommentChip.stories.tsx @@ -7,7 +7,7 @@ import { CellCommentChip } from '../CellCommentChip'; import { CommentChip } from '../CommentChip'; const meta: Meta = { - title: 'Comments/CellCommentChip', + title: 'Modules/Comments/CellCommentChip', component: CellCommentChip, }; diff --git a/front/src/modules/comments/components/__stories__/CommentHeader.stories.tsx b/front/src/modules/comments/components/__stories__/CommentHeader.stories.tsx index 579970158..37a1cfdd7 100644 --- a/front/src/modules/comments/components/__stories__/CommentHeader.stories.tsx +++ b/front/src/modules/comments/components/__stories__/CommentHeader.stories.tsx @@ -9,7 +9,7 @@ import { getRenderWrapperForComponent } from '~/testing/renderWrappers'; import { CommentHeader } from '../CommentHeader'; const meta: Meta = { - title: 'Comments/CommentHeader', + title: 'Modules/Comments/CommentHeader', component: CommentHeader, }; diff --git a/front/src/modules/comments/components/__stories__/CommentThreadRelationPicker.stories.tsx b/front/src/modules/comments/components/__stories__/CommentThreadRelationPicker.stories.tsx index 61f778657..881c5c4a5 100644 --- a/front/src/modules/comments/components/__stories__/CommentThreadRelationPicker.stories.tsx +++ b/front/src/modules/comments/components/__stories__/CommentThreadRelationPicker.stories.tsx @@ -8,7 +8,7 @@ import { getRenderWrapperForComponent } from '~/testing/renderWrappers'; import { CommentThreadRelationPicker } from '../CommentThreadRelationPicker'; const meta: Meta = { - title: 'Comments/CommentThreadRelationPicker', + title: 'Modules/Comments/CommentThreadRelationPicker', component: CommentThreadRelationPicker, parameters: { msw: graphqlMocks, diff --git a/front/src/modules/search/components/CommandMenuStyles.tsx b/front/src/modules/search/components/CommandMenuStyles.tsx index 1ace4199b..28eb2fe4e 100644 --- a/front/src/modules/search/components/CommandMenuStyles.tsx +++ b/front/src/modules/search/components/CommandMenuStyles.tsx @@ -10,7 +10,6 @@ export const StyledDialog = styled(Command.Dialog)` max-width: 640px; overflow: hidden; padding: 0; - padding: 25px; position: fixed; top: 50%; transform: translate(-50%, -50%); diff --git a/front/src/modules/search/components/__stories__/CommandMenu.stories.tsx b/front/src/modules/search/components/__stories__/CommandMenu.stories.tsx index e8647bc8f..ff28e59a1 100644 --- a/front/src/modules/search/components/__stories__/CommandMenu.stories.tsx +++ b/front/src/modules/search/components/__stories__/CommandMenu.stories.tsx @@ -5,7 +5,7 @@ import { getRenderWrapperForPage } from '~/testing/renderWrappers'; import { CommandMenu } from '../CommandMenu'; const meta: Meta = { - title: 'Pages/Search/CommandMenu', + title: 'Modules/Search/CommandMenu', component: CommandMenu, }; diff --git a/front/src/modules/ui/components/menu/stories/DropdownMenu.stories.tsx b/front/src/modules/ui/components/menu/stories/DropdownMenu.stories.tsx index cc9c40325..6edde0e34 100644 --- a/front/src/modules/ui/components/menu/stories/DropdownMenu.stories.tsx +++ b/front/src/modules/ui/components/menu/stories/DropdownMenu.stories.tsx @@ -16,7 +16,7 @@ import { DropdownMenuSelectableItem } from '../DropdownMenuSelectableItem'; import { DropdownMenuSeparator } from '../DropdownMenuSeparator'; const meta: Meta = { - title: 'Components/DropdownMenu', + title: 'UI/Menu/DropdownMenu', component: DropdownMenu, }; diff --git a/front/src/modules/ui/layout/states/isThemeEnabledState.ts b/front/src/modules/ui/layout/states/isThemeEnabledState.ts deleted file mode 100644 index 2337edf2b..000000000 --- a/front/src/modules/ui/layout/states/isThemeEnabledState.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { atom } from 'recoil'; - -export const isThemeEnabledState = atom({ - key: 'isThemeEnabledState', - default: true, -}); diff --git a/front/src/modules/users/components/__stories__/Avatar.stories.tsx b/front/src/modules/users/components/__stories__/Avatar.stories.tsx index 6f610ec4b..1c9e48649 100644 --- a/front/src/modules/users/components/__stories__/Avatar.stories.tsx +++ b/front/src/modules/users/components/__stories__/Avatar.stories.tsx @@ -5,7 +5,7 @@ import { getRenderWrapperForComponent } from '~/testing/renderWrappers'; import { Avatar } from '../Avatar'; const meta: Meta = { - title: 'Components/Common/Avatar', + title: 'Modules/Users/Avatar', component: Avatar, }; diff --git a/front/src/pages/settings/__stories__/settings.stories.tsx b/front/src/pages/settings/__stories__/settings.stories.tsx index ee42c5405..b4049a961 100644 --- a/front/src/pages/settings/__stories__/settings.stories.tsx +++ b/front/src/pages/settings/__stories__/settings.stories.tsx @@ -7,7 +7,7 @@ import { SettingsProfile } from '../SettingsProfile'; import { render } from './shared'; const meta: Meta = { - title: 'Pages/SettingsProfile', + title: 'Pages/Settings/SettingsProfile', component: SettingsProfile, };