From 24496bbf3f295f3b05232c9afebe350d36b882fa Mon Sep 17 00:00:00 2001 From: uwap Date: Tue, 10 Jul 2018 18:51:05 +0200 Subject: [PATCH] Fix PropType warnings --- src/components/SideBar.js | 10 ++++---- src/components/UiItemList/index.js | 37 +++++++++++++++++++----------- 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/src/components/SideBar.js b/src/components/SideBar.js index 869b55e..ee45c08 100644 --- a/src/components/SideBar.js +++ b/src/components/SideBar.js @@ -50,16 +50,16 @@ class SideBar extends React.PureComponent { return ( - {this.props.icon == null - || renderIcon(this.props.icon, "mdi-36px")} + {this.props.icon == null + || renderIcon(this.props.icon, "mdi-36px")} - {this.props.control == null || this.props.control.name} + {this.props.control == null ? "" : this.props.control.name} @@ -67,7 +67,7 @@ class SideBar extends React.PureComponent { - {this.props.children} + {this.props.children} ); diff --git a/src/components/UiItemList/index.js b/src/components/UiItemList/index.js index 3214361..cdfda90 100644 --- a/src/components/UiItemList/index.js +++ b/src/components/UiItemList/index.js @@ -28,56 +28,65 @@ export default class UiItemList extends React.PureComponent { ); } if (control.type === "section") { - return this.renderControl(control); + return this.renderControl(control, key.toString()); } return ( - {control.icon == null || control.type === "link" || - - {renderIcon(control.icon(this.props.state), "mdi-24px")} - } - {this.renderControl(control)} + + {control.icon == null || control.type === "link" || + + {renderIcon(control.icon(this.props.state), "mdi-24px")} + } + {this.renderControl(control, key.toString())} + ); }); } - renderControl(control: ControlUI) { + renderControl(control: ControlUI, key: string) { switch (control.type) { case "toggle": { return ; + onChangeState={this.props.onChangeState} + key={`${key}-licontrol`} />; } case "dropDown": { return ; + onChangeState={this.props.onChangeState} + key={`${key}-licontrol`} />; } case "section": { return
; + onChangeState={this.props.onChangeState} + key={`${key}-licontrol`} />; } case "link": { return ; + onChangeState={this.props.onChangeState} + key={`${key}-licontrol`} />; } case "slider": { return ; + onChangeState={this.props.onChangeState} + key={`${key}-licontrol`} />; } case "text": { return ; + onChangeState={this.props.onChangeState} + key={`${key}-licontrol`} />; } case "progress": { return ; + onChangeState={this.props.onChangeState} + key={`${key}-licontrol`} />; } default: { throw new Error(