From 3980ddc6c80becfc7b1d1bd314ebebc7a34ec24b Mon Sep 17 00:00:00 2001 From: Patrick Connolly Date: Mon, 23 Sep 2024 01:55:28 -0400 Subject: [PATCH] Added support for react-redux components. Added withRedux storybook decorator. Added stories for CreateUser, SignIn, SignOut. --- .storybook/decorators.js | 16 +++++- package-lock.json | 65 ++++++++++++++++++++++ package.json | 3 + polis | 2 +- stories/client-admin/CreateUser.stories.js | 19 +++++++ stories/client-admin/SignIn.stories.js | 19 +++++++ stories/client-admin/SignOut.stories.js | 19 +++++++ 7 files changed, 139 insertions(+), 4 deletions(-) create mode 100644 stories/client-admin/CreateUser.stories.js create mode 100644 stories/client-admin/SignIn.stories.js create mode 100644 stories/client-admin/SignOut.stories.js diff --git a/.storybook/decorators.js b/.storybook/decorators.js index 7038d46..4c6a465 100644 --- a/.storybook/decorators.js +++ b/.storybook/decorators.js @@ -1,9 +1,19 @@ import React from 'react' import { ThemeProvider } from 'theme-ui' import theme from '../polis/client-admin/src/theme' +import { Provider as ReduxProvider } from 'react-redux' +import configureStore from '../polis/client-admin/src/store' + +const store = configureStore() export const withThemeUi = (Story) => ( - - - + + + +) + +export const withRedux = (Story) => ( + + + ) \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index bc2212a..3657851 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,9 +24,12 @@ "@storybook/react": "^8.3.2", "@storybook/react-webpack5": "^8.3.2", "@storybook/test": "^8.3.2", + "jquery": "~2.1.4", "prop-types": "^15.8.1", "react": "^16.14.0", "react-dom": "^16.14.0", + "react-redux": "7.2.2", + "redux-thunk": "~2.3.0", "storybook": "^8.3.2", "storybook-addon-remix-react-router": "^3.0.0" } @@ -4904,6 +4907,12 @@ "url": "https://github.com/chalk/supports-color?sponsor=1" } }, + "node_modules/jquery": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-2.1.4.tgz", + "integrity": "sha512-wWR+eCq/T/Qt0NcFyM+QVho0ZVzWxFYANijmSMImXiM5mjr1aOaf4SF0eOEPc92bbK2L2vDpxw3lIszus7eO8Q==", + "dev": true + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -6023,6 +6032,46 @@ "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", "dev": true }, + "node_modules/react-redux": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-7.2.2.tgz", + "integrity": "sha512-8+CQ1EvIVFkYL/vu6Olo7JFLWop1qRUeb46sGtIMDCSpgwPQq8fPLpirIB0iTqFe9XYEFPHssdX8/UwN6pAkEA==", + "dev": true, + "dependencies": { + "@babel/runtime": "^7.12.1", + "hoist-non-react-statics": "^3.3.2", + "loose-envify": "^1.4.0", + "prop-types": "^15.7.2", + "react-is": "^16.13.1" + }, + "peerDependencies": { + "react": "^16.8.3 || ^17", + "redux": "^2.0.0 || ^3.0.0 || ^4.0.0-0" + }, + "peerDependenciesMeta": { + "react-dom": { + "optional": true + }, + "react-native": { + "optional": true + } + } + }, + "node_modules/react-redux/node_modules/hoist-non-react-statics": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz", + "integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==", + "dev": true, + "dependencies": { + "react-is": "^16.7.0" + } + }, + "node_modules/react-redux/node_modules/react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", + "dev": true + }, "node_modules/react-router": { "version": "6.26.2", "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.26.2.tgz", @@ -6110,6 +6159,22 @@ "node": ">=8" } }, + "node_modules/redux": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/redux/-/redux-4.2.1.tgz", + "integrity": "sha512-LAUYz4lc+Do8/g7aeRa8JkyDErK6ekstQaqWQrNRW//MY1TvCEpMtpTWvlQ+FPbWCx+Xixu/6SHt5N0HR+SB4w==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/runtime": "^7.9.2" + } + }, + "node_modules/redux-thunk": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-2.3.0.tgz", + "integrity": "sha512-km6dclyFnmcvxhAcrQV2AkZmPQjzPDjgVlQtR0EQjxZPyJ0BnMf3in1ryuR8A2qU0HldVRfxYXbFSKlI3N7Slw==", + "dev": true + }, "node_modules/regenerator-runtime": { "version": "0.14.1", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", diff --git a/package.json b/package.json index 555294f..19a50ff 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "author": "", "license": "ISC", "devDependencies": { + "jquery": "~2.1.4", "@chromatic-com/storybook": "^1.9.0", "@storybook/addon-essentials": "^8.3.2", "@storybook/addon-interactions": "^8.3.2", @@ -24,6 +25,8 @@ "prop-types": "^15.8.1", "react": "^16.14.0", "react-dom": "^16.14.0", + "react-redux": "7.2.2", + "redux-thunk": "~2.3.0", "storybook": "^8.3.2", "storybook-addon-remix-react-router": "^3.0.0" }, diff --git a/polis b/polis index 68919d4..9733a71 160000 --- a/polis +++ b/polis @@ -1 +1 @@ -Subproject commit 68919d4d1f62b80065aa55afbcef0882bdbc850e +Subproject commit 9733a715d8215a4573dc5ec0f115fd9e42d1dd99 diff --git a/stories/client-admin/CreateUser.stories.js b/stories/client-admin/CreateUser.stories.js new file mode 100644 index 0000000..69740a8 --- /dev/null +++ b/stories/client-admin/CreateUser.stories.js @@ -0,0 +1,19 @@ +import React from 'react' +import CreateUser from '../../polis/client-admin/src/components/landers/createuser' +import { withThemeUi, withRedux } from '../../.storybook/decorators' +import { withRouter, reactRouterParameters } from 'storybook-addon-remix-react-router' + +export default { + title: 'Client-Admin/CreateUser', + component: CreateUser, + decorators: [withThemeUi, withRedux, withRouter], +} + +const Template = (args) => + +export const Default = Template.bind({}) +Default.args = { + location: { + pathname: '/createuser', + } +} diff --git a/stories/client-admin/SignIn.stories.js b/stories/client-admin/SignIn.stories.js new file mode 100644 index 0000000..c523d22 --- /dev/null +++ b/stories/client-admin/SignIn.stories.js @@ -0,0 +1,19 @@ +import React from 'react' +import SignIn from '../../polis/client-admin/src/components/landers/signin' +import { withThemeUi, withRedux } from '../../.storybook/decorators' +import { withRouter } from 'storybook-addon-remix-react-router' + +export default { + title: 'Client-Admin/SignIn', + component: SignIn, + decorators: [withThemeUi, withRedux, withRouter], +} + +const Template = (args) => + +export const Default = Template.bind({}) +Default.args = { + location: { + pathname: '/signin', + } +} diff --git a/stories/client-admin/SignOut.stories.js b/stories/client-admin/SignOut.stories.js new file mode 100644 index 0000000..67cdd3f --- /dev/null +++ b/stories/client-admin/SignOut.stories.js @@ -0,0 +1,19 @@ +import React from 'react' +import SignOut from '../../polis/client-admin/src/components/landers/signout' +import { withThemeUi, withRedux } from '../../.storybook/decorators' +import { withRouter } from 'storybook-addon-remix-react-router' + +export default { + title: 'Client-Admin/SignOut', + component: SignOut, + decorators: [withThemeUi, withRedux, withRouter], +} + +const Template = (args) => + +export const Default = Template.bind({}) +Default.args = { + location: { + pathname: '/signin', + } +}