-
Notifications
You must be signed in to change notification settings - Fork 491
Expand file tree
/
Copy pathBoard.js
More file actions
41 lines (37 loc) · 1.15 KB
/
Copy pathBoard.js
File metadata and controls
41 lines (37 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import React, {Component} from 'react'
import {Provider} from 'react-redux'
import classNames from 'classnames'
import {applyMiddleware, createStore} from 'redux'
import logger from 'redux-logger'
import {v1 as uuidv1} from 'uuid'
import BoardContainer from './BoardContainer'
import createTranslate from 'rt/helpers/createTranslate'
import boardReducer from 'rt/reducers/BoardReducer'
const middlewares = process.env.REDUX_LOGGING ? [logger] : []
export default class Board extends Component {
constructor({id}) {
super()
this.store = this.getStore()
this.id = id || uuidv1()
}
getStore = () => {
//When you create multiple boards, unique stores are created for isolation
return createStore(boardReducer, applyMiddleware(...middlewares))
}
render() {
const {id, className, components} = this.props
const allClassNames = classNames('react-trello-board', className || '')
return (
<Provider store={this.store}>
<>
<components.GlobalStyle />
<BoardContainer
id={this.id}
{...this.props}
className={allClassNames}
/>
</>
</Provider>
)
}
}