Use state instead of component hand-down for managing filter

This commit is contained in:
Kyle Shockey
2017-07-11 21:54:56 -07:00
parent cf12091d93
commit 28f7a15fe9
5 changed files with 16 additions and 33 deletions

View File

@@ -7,8 +7,8 @@ import Logo from "./logo_small.png"
export default class Topbar extends React.Component {
static propTypes = {
onFilterChange: PropTypes.func.isRequired,
filter: PropTypes.string.isRequired
layoutSelectors: PropTypes.object.isRequired,
layoutActions: PropTypes.object.isRequired
}
constructor(props, context) {
@@ -87,17 +87,17 @@ export default class Topbar extends React.Component {
onFilterChange =(e) => {
let {target: {value}} = e
this.props.onFilterChange(value)
this.props.layoutActions.updateFilter(value)
}
render() {
let { getComponent, specSelectors, getConfigs } = this.props
let { getComponent, specSelectors, getConfigs, layoutSelectors } = this.props
const Button = getComponent("Button")
const Link = getComponent("Link")
let isLoading = specSelectors.loadingStatus() === "loading"
let isFailed = specSelectors.loadingStatus() === "failed"
let filter = this.props.filter
let filter = layoutSelectors.currentFilter()
let inputStyle = {}
if(isFailed) inputStyle.color = "red"