Skip to content

Commit

Permalink
add storybook css
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip Weiss committed Jul 1, 2018
1 parent 8cd1c2f commit 532c167
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ coverage
build
css/styles.css
.nyc_output
css/styles.css

# Only apps should have lockfiles
yarn.lock
Expand Down
15 changes: 15 additions & 0 deletions .storybook-css/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { configure } from '@kadira/storybook';
import ThemedStyleSheet from 'react-with-styles/lib/ThemedStyleSheet';
import aphroditeInterface from 'react-with-styles-interface-aphrodite';
import '../css/styles.css';
import registerCSSInterfaceWithDefaultTheme from '../scripts/utils/registerCSSInterfaceWithDefaultTheme';


/* Register react with styles interface */
registerCSSInterfaceWithDefaultTheme();

function loadStories() {
require('../stories/ExampleSlider');
}

configure(loadStories, module);
13 changes: 13 additions & 0 deletions .storybook-css/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const path = require('path');

module.exports = {
module: {
loaders: [
{
test: /\.css?$/,
loaders: [ 'style', 'raw' ],
include: path.resolve(__dirname, '../')
}
]
}
}
6 changes: 1 addition & 5 deletions .storybook/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@ import DefaultTheme from '../src/themes/DefaultTheme';
ThemedStyleSheet.registerTheme(DefaultTheme);
ThemedStyleSheet.registerInterface(aphroditeInterface);

/* Register react with styles interface */
ThemedStyleSheet.registerTheme(DefaultTheme);
ThemedStyleSheet.registerInterface(aphroditeInterface);

function loadStories() {
require('../stories/ExampleSlider.jsx');
require('../stories/ExampleSlider');
}

configure(loadStories, module);
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"prepublish": "npm run build",
"lint": "eslint --ext .js,.jsx src test stories",
"storybook": "start-storybook -p 9001",
"prestorybook:css": "npm run build:css",
"storybook:css": "start-storybook -p 6006 -c .storybook-css",
"pretest": "npm run build && npm run lint",
"test": "nyc npm run test:all",
"tests-only": "npm run test:all",
Expand Down
6 changes: 0 additions & 6 deletions src/Slider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -747,15 +747,10 @@ class Rheostat extends React.Component {
} = this.props;

const {
handleDimensions,
handlePos,
values,
} = this.state;

const handleContainerStyle = orientation === VERTICAL
? { left: 0, bottom: handleDimensions / 2, top: handleDimensions / 2 }
: { top: 0, left: handleDimensions / 2, right: handleDimensions / 2 };

return (
// eslint-disable-next-line jsx-a11y/click-events-have-key-events
<div
Expand All @@ -770,7 +765,6 @@ class Rheostat extends React.Component {
ref={this.setHandleContainerNode}
{...css(
styles.handleContainer,
handleContainerStyle,
styles.rheostat_background,
orientation === VERTICAL
? styles.rheostat_background__vertical
Expand Down

0 comments on commit 532c167

Please sign in to comment.