Fix the icon color + allow changing icons depending on the state

This commit is contained in:
uwap 2017-11-11 05:44:04 +01:00
parent 2c433c7df0
commit bcb35877c1
7 changed files with 47 additions and 13 deletions

View file

@ -13,6 +13,7 @@ import TopBar from "components/TopBar";
import UiItemList from "components/UiItemList";
import keyOf from "utils/keyOf";
import { controlGetIcon } from "utils/parseIconName";
export type AppProps = {
config: Config
@ -79,11 +80,15 @@ class App extends React.Component<AppProps & Classes, AppState> {
<SideBar open={this.state.drawerOpened}
control={this.state.selectedControl}
onCloseRequest={this.closeDrawer.bind(this)}
icon={this.state.selectedControl == null ? null :
controlGetIcon(this.state.selectedControl,
this.state.mqttState)}
>
{this.state.selectedControl == null
|| <UiItemList state={this.state.mqttState}
controls={this.state.selectedControl.ui}
onChangeState={this.changeState.bind(this)} />}
onChangeState={this.changeState.bind(this)}
/>}
</SideBar>
</div>
</MuiThemeProvider>