File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,12 +6,17 @@ import boardReducer from '../reducers/BoardReducer'
66import logger from 'redux-logger'
77
88const middlewares = process . env . NODE_ENV === 'development' ? [ logger ] : [ ]
9- const store = createStore ( boardReducer , applyMiddleware ( ...middlewares ) )
109
1110export default class Board extends Component {
11+
12+ getStore = ( ) => {
13+ //When you create multiple boards, unique stores are created for isolation
14+ return createStore ( boardReducer , applyMiddleware ( ...middlewares ) )
15+ }
16+
1217 render ( ) {
1318 return (
14- < Provider store = { store } >
19+ < Provider store = { this . getStore ( ) } >
1520 < BoardContainer { ...this . props } />
1621 </ Provider >
1722 )
Original file line number Diff line number Diff line change 1+ import React from 'react'
2+ import { withInfo } from '@storybook/addon-info'
3+ import { storiesOf } from '@storybook/react'
4+
5+ import Board from '../src'
6+
7+ const data1 = require ( './data/base.json' )
8+ const data2 = require ( './data/other-board' )
9+
10+ const containerStyles = {
11+ height : 500 ,
12+ padding : 20
13+ }
14+
15+ storiesOf ( 'Multiple Boards' , module ) . add (
16+ 'Two Boards' ,
17+ withInfo ( 'Have two boards rendering their own data' ) ( ( ) => {
18+ return (
19+ < div style = { { display : 'flex' , flexDirection : 'column' } } >
20+ < div style = { containerStyles } >
21+ < Board data = { data1 } />
22+ </ div >
23+ < div style = { containerStyles } >
24+ < Board data = { data2 } />
25+ </ div >
26+ </ div >
27+ )
28+ } )
29+ )
Original file line number Diff line number Diff line change 1+ {
2+ "lanes" : [
3+ {
4+ "id" : " yesterday" ,
5+ "title" : " Yesterday" ,
6+ "label" : " 20/70" ,
7+ "cards" : [
8+ {
9+ "id" : " Wip1" ,
10+ "title" : " Clean House" ,
11+ "label" : " 30 mins" ,
12+ "description" : " Soap wash and polish floor. Polish windows and doors. Scrap all broken glasses"
13+ }
14+ ]
15+ },
16+ {
17+ "id" : " today" ,
18+ "title" : " Today" ,
19+ "label" : " 10/20" ,
20+ "droppable" : false ,
21+ "cards" : [
22+ {
23+ "id" : " Milk" ,
24+ "title" : " Buy milk" ,
25+ "label" : " 15 mins" ,
26+ "description" : " 2 Gallons of milk at the Deli store"
27+ },
28+ {
29+ "id" : " Plan2" ,
30+ "title" : " Dispose Garbage" ,
31+ "label" : " 10 mins" ,
32+ "description" : " Sort out recyclable and waste as needed"
33+ },
34+ {
35+ "id" : " Plan3" ,
36+ "title" : " Write Blog" ,
37+ "label" : " 30 mins" ,
38+ "description" : " Can AI make memes?"
39+ },
40+ {
41+ "id" : " Plan4" ,
42+ "title" : " Pay Rent" ,
43+ "label" : " 5 mins" ,
44+ "description" : " Transfer to bank account"
45+ }
46+ ]
47+ },
48+ {
49+ "id" : " tomorrow" ,
50+ "title" : " Tomorrow" ,
51+ "label" : " 0/0" ,
52+ "cards" : []
53+ }
54+ ]
55+ }
Original file line number Diff line number Diff line change @@ -13,3 +13,4 @@ import './BoardStyling.story'
1313import './AsyncLoad.story'
1414import './RestrictedLanes.story'
1515import './EditableBoard.story'
16+ import './MultipleBoards.story'
You can’t perform that action at this time.
0 commit comments