Skip to content

Commit

Permalink
Fixes #21931 - Add react-storybook to Katello
Browse files Browse the repository at this point in the history
Adds dependency for react-storybook as well as the deployer.
I've included one story as an example.

http://projects.theforeman.org/issues/21931
  • Loading branch information
danseethaler authored and Walden Raines committed Dec 12, 2017
1 parent 472c322 commit 13b438b
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .storybook/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { configure } from '@storybook/react';

global.__ = str => str;

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

configure(loadStories, module);
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"name": "katello",
"version": "1.0.0",
"scripts": {
"storybook": "start-storybook -p 6007",
"storybook:deploy": "storybook-to-ghpages",
"test": "jest webpack",
"test:watch": "jest webpack --watchAll",
"test:current": "jest webpack --watch",
Expand All @@ -17,6 +19,8 @@
"url": "http://projects.theforeman.org/projects/katello/issues"
},
"devDependencies": {
"@storybook/react": "^3.2.17",
"@storybook/storybook-deployer": "^2.0.0",
"babel-jest": "^21.2.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';
import { storiesOf } from '@storybook/react';
import EnabledRepository from './EnabledRepository.js';

storiesOf('RedHat Repositories Page', module).add('Enabled Repository', () => (
<EnabledRepository
id={638}
name="Red Hat Enterprise Linux 6 Server Kickstart x86_64 6.8"
releasever="6.8"
arch="x86_64"
type="rpm"
/>
));
12 changes: 12 additions & 0 deletions webpack/stories/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { configure } from '@storybook/react';

require('patternfly/dist/css/patternfly.min.css');
require('patternfly/dist/css/patternfly-additions.min.css');

const req = require.context('../', true, /.stories.js$/);

function loadStories() {
req.keys().forEach(filename => req(filename));
}

configure(loadStories, module);

0 comments on commit 13b438b

Please sign in to comment.