Skip to content

Commit

Permalink
docs: add PostPreview story (#281)
Browse files Browse the repository at this point in the history
* chore: delete unsupported files

* docs: add PostPreview story

* style: fix eslint errors
  • Loading branch information
pure-js authored Oct 31, 2023
1 parent aba2643 commit 06bab53
Show file tree
Hide file tree
Showing 17 changed files with 701 additions and 396 deletions.
6 changes: 0 additions & 6 deletions .idea/inspectionProfiles/Project_Default.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/jsLibraryMappings.xml

This file was deleted.

13 changes: 0 additions & 13 deletions .idea/local-microblogging-client.iml

This file was deleted.

9 changes: 0 additions & 9 deletions .idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

9 changes: 0 additions & 9 deletions .idea/runConfigurations/npm_i.xml

This file was deleted.

9 changes: 0 additions & 9 deletions .idea/runConfigurations/npm_start.xml

This file was deleted.

9 changes: 0 additions & 9 deletions .idea/startup.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

4 changes: 0 additions & 4 deletions .idea/watcherTasks.xml

This file was deleted.

4 changes: 3 additions & 1 deletion .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ const config: StorybookConfig = {
name: '@storybook/addon-styling',
options: {},
},
'@storybook/addon-mdx-gfm',
'storybook-addon-react-router-v6',
],
framework: {
name: '@storybook/react-vite',
Expand All @@ -18,4 +20,4 @@ const config: StorybookConfig = {
autodocs: 'tag',
},
};
export default config;
export default config satisfies StorybookConfig;
18 changes: 16 additions & 2 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
import type { Preview } from '@storybook/react';

import { withThemeByDataAttribute } from '@storybook/addon-styling';
import { withRouter } from 'storybook-addon-react-router-v6';

/* TODO: update import to your tailwind styles file */
import '../src/index.css';

const reactRouterParams = {
location: {
pathParams: { userId: '42' },
searchParams: { tab: 'activityLog' },
state: { fromPage: 'homePage' },
},
routing: {
path: '/users/:userId',
handle: 'Profile',
},
};

const preview: Preview = {
parameters: {
actions: { argTypesRegex: '^on[A-Z].*' },
Expand All @@ -14,9 +27,10 @@ const preview: Preview = {
date: /Date$/,
},
},
reactRouter: reactRouterParams,
},

decorators: [
withRouter,
// Adds theme switching support.
// NOTE: requires setting "darkMode" to "class" in your tailwind config
withThemeByDataAttribute({
Expand All @@ -30,4 +44,4 @@ const preview: Preview = {
],
};

export default preview;
export default preview satisfies Preview;
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@
"@storybook/addon-essentials": "^7.5.2",
"@storybook/addon-interactions": "^7.5.2",
"@storybook/addon-links": "^7.5.2",
"@storybook/addon-styling": "^1.3.0",
"@storybook/addon-mdx-gfm": "^7.5.2",
"@storybook/addon-styling": "^1.3.7",
"@storybook/blocks": "^7.5.2",
"@storybook/react": "^7.5.2",
"@storybook/react-vite": "^7.5.2",
"@storybook/testing-library": "^0.2.0",
"@storybook/testing-library": "^0.2.2",
"@tailwindcss/typography": "^0.5.7",
"@types/react": "^18.0.15",
"@types/react-dom": "^18.0.6",
Expand All @@ -58,14 +59,15 @@
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-storybook": "^0.6.12",
"eslint-plugin-storybook": "^0.6.15",
"lightningcss": "^1.22.0",
"msw": "^1.2.2",
"postcss": "^8.4.18",
"postcss-nesting": "12.0.1",
"prettier": "3.0.3",
"standard-version": "^9.5.0",
"storybook": "^7.5.2",
"storybook-addon-react-router-v6": "~2.0.8",
"tailwindcss": "^3.3.2",
"typescript": "^5.1.3",
"vite": "^4.5.0",
Expand Down
Loading

0 comments on commit 06bab53

Please sign in to comment.