forked from athensresearch/athens
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Merge pull request athensresearch#2344 from filipesilva/react…
- Loading branch information
Showing
15 changed files
with
7,125 additions
and
966 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const path = require('path'); | ||
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); | ||
|
||
module.exports = { | ||
features: { | ||
postcss: false, | ||
}, | ||
"stories": [ | ||
"../src/js/**/*.stories.mdx", | ||
"../src/js/**/*.stories.tsx" | ||
], | ||
"addons": [ | ||
"@storybook/addon-links", | ||
"@storybook/addon-essentials", | ||
"@storybook/addon-a11y", | ||
'storybook-dark-mode', | ||
'@geometricpanda/storybook-addon-badges' | ||
], | ||
webpackFinal: async (config, { configType }) => { | ||
// Resolve the root path defined in tsconfig.json | ||
config.resolve.plugins.push( | ||
new TsconfigPathsPlugin({ | ||
configFile: path.resolve(__dirname, '../tsconfig.json'), | ||
}) | ||
); | ||
|
||
// Support mjs modules included with Chakra-UI | ||
// https://github.com/storybookjs/storybook/issues/16690#issuecomment-971579785 | ||
config.module.rules.push({ | ||
test: /\.mjs$/, | ||
include: /node_modules/, | ||
type: "javascript/auto", | ||
}) | ||
// Return the altered config. | ||
return config; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import React from 'react'; | ||
|
||
import { themes } from '@storybook/theming'; | ||
import { ChakraProvider } from '@chakra-ui/react'; | ||
|
||
|
||
import { theme } from '../src/js/theme/theme'; | ||
import { badges, Storybook } from '../src/js/components/utils/storybook'; | ||
|
||
export const parameters = { | ||
actions: { argTypesRegex: "^on[A-Z].*" }, | ||
layout: 'fullscreen', | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/, | ||
}, | ||
}, | ||
badgesConfig: { | ||
...badges | ||
}, | ||
darkMode: { | ||
// Override the default dark theme | ||
dark: { | ||
...themes.dark, | ||
appBg: '#151515', | ||
appContentBg: '#1A1A1A', | ||
}, | ||
// Override the default light theme | ||
light: { | ||
...themes.normal, | ||
appBg: '#EFEDEB', | ||
appContentBg: "#F6F6F6" | ||
} | ||
} | ||
} | ||
|
||
export const globalTypes = { | ||
theme: { | ||
name: 'Story Theme', | ||
description: 'Global theme for components', | ||
defaultValue: 'light', | ||
toolbar: { | ||
// Array of plain string values or MenuItem shape (see below) | ||
items: ['light', 'dark'], | ||
// Property that specifies if the name of the item will be displayed | ||
showName: true, | ||
}, | ||
}, | ||
}; | ||
|
||
|
||
export const decorators = [ | ||
(Story, context) => { | ||
|
||
React.useEffect(() => { | ||
const theme = context.globals.theme === 'dark' ? 'is-theme-dark' : 'is-theme-light'; | ||
document.body.classList.add(theme); | ||
return () => document.body.classList.remove(theme); | ||
}, [context]) | ||
|
||
console.log(context); | ||
return ( | ||
<> | ||
<ChakraProvider> | ||
<Storybook.App | ||
id="app" > | ||
<Story /> | ||
</Storybook.App> | ||
</ChakraProvider> | ||
</> | ||
) | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.