diff --git a/packages/devui/.storybook/config.js b/packages/devui/.storybook/config.js index c6cd1ea8..4eb08749 100755 --- a/packages/devui/.storybook/config.js +++ b/packages/devui/.storybook/config.js @@ -1,23 +1,23 @@ import { configure, setAddon, addDecorator } from '@storybook/react'; -import { setOptions } from '@storybook/addon-options'; -import infoAddon from '@storybook/addon-info'; +import { withOptions } from '@storybook/addon-options'; +import { withInfo } from '@storybook/addon-info'; import { withKnobs } from '@storybook/addon-knobs'; import { withTheme } from './themeAddon/theme'; import '../src/presets.js'; -setAddon(infoAddon); -setOptions({ +addDecorator(withOptions({ name: 'DevUI', url: 'https://github.com/reduxjs/redux-devtools/tree/master/packages/devui', goFullScreen: false, - showLeftPanel: true, - showDownPanel: true, + showStoriesPanel: true, + showAddonPanel: true, showSearchBox: false, - downPanelInRight: true -}); + addonPanelInRight: true +})); addDecorator(withTheme); addDecorator(withKnobs); +addDecorator(withInfo); const req = require.context('../src/', true, /stories\/index\.js$/); diff --git a/packages/devui/.storybook/preview-head.html b/packages/devui/.storybook/preview-head.html index 95c0c9cd..f8b8b606 100644 --- a/packages/devui/.storybook/preview-head.html +++ b/packages/devui/.storybook/preview-head.html @@ -14,7 +14,7 @@ font-family: "Helvetica Neue", "Lucida Grande", sans-serif; font-size: 11px; } - #root, #root > div, #root > div > div { + #root, #root > div { height: 100%; } #root > div > div { @@ -22,5 +22,6 @@ flex-direction: column; width: 100%; height: 100%; + overflow-y: auto; } diff --git a/packages/devui/.storybook/themeAddon/Panel.js b/packages/devui/.storybook/themeAddon/Panel.js index 713c932d..7e0ee5f4 100644 --- a/packages/devui/.storybook/themeAddon/Panel.js +++ b/packages/devui/.storybook/themeAddon/Panel.js @@ -25,6 +25,8 @@ export default class Panel extends React.Component { this.setState(state); }; + onClick = () => {}; + render() { const { theme, scheme, light } = this.state; return ( @@ -50,6 +52,7 @@ export default class Panel extends React.Component { } ]} onFieldChange={this.onChange} + onFieldClick={this.onClick} /> ); diff --git a/packages/devui/.storybook/themeAddon/register.js b/packages/devui/.storybook/themeAddon/register.js index 6fa38b07..1b51f2d7 100644 --- a/packages/devui/.storybook/themeAddon/register.js +++ b/packages/devui/.storybook/themeAddon/register.js @@ -7,6 +7,10 @@ addons.register(ADDON_ID, api => { const channel = addons.getChannel(); addons.addPanel(PANEL_ID, { title: 'Theme', - render: () => + render: ({ active }) => ( + active ? + + : null + ) }); }); diff --git a/packages/devui/.storybook/themeAddon/theme.js b/packages/devui/.storybook/themeAddon/theme.js index 3a3ff767..120db290 100644 --- a/packages/devui/.storybook/themeAddon/theme.js +++ b/packages/devui/.storybook/themeAddon/theme.js @@ -1,22 +1,8 @@ import React from 'react'; import addons from '@storybook/addons'; -import styled from 'styled-components'; import { EVENT_ID_DATA, DEFAULT_THEME_STATE } from './constant'; import { Container } from '../../src'; -const ContainerStyled = styled(Container)` - > div { - height: 100%; - width: 100%; - - > div { - height: 100%; - width: 100%; - overflow-y: auto; - } - } -`; - const channel = addons.getChannel(); class Theme extends React.Component { @@ -35,7 +21,7 @@ class Theme extends React.Component { }; render() { - return {this.props.children}; + return {this.props.children}; } } diff --git a/packages/devui/.storybook/user/modify_webpack_config.js b/packages/devui/.storybook/user/modify_webpack_config.js deleted file mode 100755 index 2716de91..00000000 --- a/packages/devui/.storybook/user/modify_webpack_config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = function (config) { - // This is the default webpack config defined in the `../webpack.config.js` - // modify as you need. -}; diff --git a/packages/devui/.storybook/webpack.config.js b/packages/devui/.storybook/webpack.config.js index 08dec07a..9fc16d31 100755 --- a/packages/devui/.storybook/webpack.config.js +++ b/packages/devui/.storybook/webpack.config.js @@ -1,26 +1,8 @@ const path = require('path'); -const updateConfig = require('./user/modify_webpack_config'); -const config = { - module: { - rules: [ - { - test: /\.css?$/, - use: [{ loader: 'style-loader' }, { loader: 'raw-loader' }], - include: path.resolve(__dirname, '../') - }, - { - test: /\.json?$/, - loader: 'json-loader', - include: path.resolve(__dirname, '../') - }, - { - test: /\.woff2?(\?\S*)?$/, - loader: 'url?limit=65000&mimetype=application/font-woff' - } - ] - } +module.exports = (baseConfig, env, defaultConfig) => { + // Add custom webpack config here like: + // defaultConfig.module.rules.push + + return defaultConfig; }; - -updateConfig(config); -module.exports = config; diff --git a/packages/devui/package.json b/packages/devui/package.json index 09373ed9..3503b566 100755 --- a/packages/devui/package.json +++ b/packages/devui/package.json @@ -30,11 +30,11 @@ }, "homepage": "https://github.com/reduxjs/redux-devtools", "devDependencies": { - "@storybook/addon-actions": "^3.2.13", - "@storybook/addon-info": "^3.2.13", - "@storybook/addon-knobs": "^3.2.13", - "@storybook/addon-options": "^3.2.13", - "@storybook/react": "^3.2.13", + "@storybook/addon-actions": "^4.1.4", + "@storybook/addon-info": "^4.1.4", + "@storybook/addon-knobs": "^4.1.4", + "@storybook/addon-options": "^4.1.4", + "@storybook/react": "4.0.9", "babel-cli": "^6.26.0", "babel-core": "^6.26.0", "babel-eslint": "^6.0.2", @@ -45,7 +45,6 @@ "babel-preset-es2015": "^6.24.1", "babel-preset-react": "^6.24.1", "babel-preset-stage-0": "^6.16.0", - "css-loader": "^0.28.7", "enzyme": "^3.1.0", "enzyme-adapter-react-16": "^1.0.2", "enzyme-to-json": "^3.1.4", @@ -54,25 +53,18 @@ "eslint-plugin-babel": "^3.2.0", "eslint-plugin-jsx-a11y": "^0.6.2", "eslint-plugin-react": "^4.3.0", - "file-loader": "^1.1.5", "git-url-parse": "^7.0.1", "jest": "^23.6.0", "jsdom": "^11.3.0", - "node-sass": "^3.13.0", - "postcss-loader": "^2.0.8", "prettier-eslint-cli": "^4.4.0", - "raw-loader": "^0.5.1", "react": "^16.0.0", "react-addons-test-utils": "^15.6.2", "react-dom": "^16.0.0", "react-test-renderer": "^16.0.0", "rimraf": "^2.6.2", - "sass-loader": "^4.0.2", - "style-loader": "^0.19.0", "stylelint": "^7.6.0", "stylelint-config-standard": "^15.0.0", - "stylelint-processor-styled-components": "^0.0.4", - "url-loader": "^0.6.2" + "stylelint-processor-styled-components": "^0.0.4" }, "peerDependencies": { "react": "^0.14.9 || ^15.3.0" diff --git a/packages/devui/src/Button/stories/index.js b/packages/devui/src/Button/stories/index.js index 6fe19ed8..60522c76 100755 --- a/packages/devui/src/Button/stories/index.js +++ b/packages/devui/src/Button/stories/index.js @@ -16,9 +16,8 @@ export const Container = styled.div` storiesOf('Button', module) .addDecorator(withKnobs) - .addWithInfo( + .add( 'default', - '', () => (