-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add storybook so it's easier to test changes
- Loading branch information
1 parent
4929ce8
commit a32770b
Showing
5 changed files
with
80 additions
and
5 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,8 @@ | ||
import { configure } from '@kadira/storybook'; | ||
import '../node_modules/bootstrap/dist/css/bootstrap.min.css'; | ||
|
||
function loadStories() { | ||
require('../stories'); | ||
} | ||
|
||
configure(loadStories, module); |
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,13 @@ | ||
const genDefaultConfig = require('@kadira/storybook/dist/server/config/defaults/webpack.config.js'); | ||
const webpack = require('webpack'); | ||
|
||
|
||
module.exports = function(config, env) { | ||
const defaultConfig = genDefaultConfig(config, env); | ||
const withOldPlugin = Object.assign({}, defaultConfig, { | ||
plugins: defaultConfig.plugins.concat([ | ||
new webpack.OldWatchingPlugin(), | ||
]) | ||
}) | ||
return withOldPlugin; | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React, { Component } from 'react'; | ||
import sematable, { Table } from '../src'; | ||
|
||
const columns = [ | ||
{ key: 'id', primaryKey: true, header: 'ID' }, | ||
{ key: 'firstName', header: 'First name', filterable: true, sortable: true }, | ||
{ key: 'lastName', header: 'Last name', filterable: true, sortable: true }, | ||
{ key: 'status', header: 'Status', taggable: true }, | ||
]; | ||
|
||
class UsersTable extends Component { | ||
render() { | ||
return <Table {...this.props} columns={columns} />; | ||
} | ||
} | ||
export default sematable('usersTable', UsersTable, columns); |
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,33 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@kadira/storybook'; | ||
import { Provider } from 'react-redux'; | ||
import { combineReducers, createStore } from 'redux'; | ||
import { reducer as sematable } from '../src'; | ||
import UsersTable from './UsersTable'; | ||
|
||
const reducer = combineReducers({ sematable }); | ||
const store = createStore(reducer); | ||
|
||
const users = [ | ||
{ | ||
id: 1, | ||
firstName: 'John', | ||
lastName: 'Doe', | ||
status: 'UNKNOWN', | ||
}, | ||
{ | ||
id: 2, | ||
firstName: 'Bob', | ||
lastName: 'McBobber', | ||
status: 'ACTIVE', | ||
}, | ||
]; | ||
|
||
storiesOf('Sematable', module) | ||
.add('default', () => ( | ||
<Provider store={store}> | ||
<div className="container-fluid"> | ||
<UsersTable data={users} /> | ||
</div> | ||
</Provider> | ||
)); |