Fix PropType warnings
This commit is contained in:
parent
0fe8911d79
commit
24496bbf3f
2 changed files with 28 additions and 19 deletions
|
|
@ -50,16 +50,16 @@ class SideBar extends React.PureComponent<Props, SideBarState> {
|
||||||
return (
|
return (
|
||||||
<Drawer open={this.props.open}
|
<Drawer open={this.props.open}
|
||||||
anchor="right"
|
anchor="right"
|
||||||
onRequestClose={this.close}
|
onClose={this.close}
|
||||||
classes={{paper: this.props.classes.drawerPaper}}
|
classes={{paper: this.props.classes.drawerPaper}}
|
||||||
variant="persistent"
|
variant="persistent"
|
||||||
>
|
>
|
||||||
<AppBar position="static">
|
<AppBar position="static">
|
||||||
<Toolbar>
|
<Toolbar>
|
||||||
{this.props.icon == null
|
<span>{this.props.icon == null
|
||||||
|| renderIcon(this.props.icon, "mdi-36px")}
|
|| renderIcon(this.props.icon, "mdi-36px")}</span>
|
||||||
<Typography variant="title" className={this.props.classes.flex}>
|
<Typography variant="title" className={this.props.classes.flex}>
|
||||||
{this.props.control == null || this.props.control.name}
|
{this.props.control == null ? "" : this.props.control.name}
|
||||||
</Typography>
|
</Typography>
|
||||||
<IconButton onClick={this.close.bind(this)}>
|
<IconButton onClick={this.close.bind(this)}>
|
||||||
<i className="mdi mdi-close mdi-36px"></i>
|
<i className="mdi mdi-close mdi-36px"></i>
|
||||||
|
|
@ -67,7 +67,7 @@ class SideBar extends React.PureComponent<Props, SideBarState> {
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
</AppBar>
|
</AppBar>
|
||||||
<List id="drawer_uiComponents">
|
<List id="drawer_uiComponents">
|
||||||
{this.props.children}
|
<React.Fragment>{this.props.children}</React.Fragment>
|
||||||
</List>
|
</List>
|
||||||
</Drawer>
|
</Drawer>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -28,56 +28,65 @@ export default class UiItemList extends React.PureComponent<UiItemListProps> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (control.type === "section") {
|
if (control.type === "section") {
|
||||||
return this.renderControl(control);
|
return this.renderControl(control, key.toString());
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<ListItem key={key}>
|
<ListItem key={key}>
|
||||||
|
<React.Fragment>
|
||||||
{control.icon == null || control.type === "link" ||
|
{control.icon == null || control.type === "link" ||
|
||||||
<ListItemIcon>
|
<ListItemIcon key={`${key.toString()}-liicon`}>
|
||||||
{renderIcon(control.icon(this.props.state), "mdi-24px")}
|
{renderIcon(control.icon(this.props.state), "mdi-24px")}
|
||||||
</ListItemIcon>}
|
</ListItemIcon>}
|
||||||
{this.renderControl(control)}
|
{this.renderControl(control, key.toString())}
|
||||||
|
</React.Fragment>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
renderControl(control: ControlUI) {
|
renderControl(control: ControlUI, key: string) {
|
||||||
switch (control.type) {
|
switch (control.type) {
|
||||||
case "toggle": {
|
case "toggle": {
|
||||||
return <Toggle item={control}
|
return <Toggle item={control}
|
||||||
state={this.props.state}
|
state={this.props.state}
|
||||||
onChangeState={this.props.onChangeState} />;
|
onChangeState={this.props.onChangeState}
|
||||||
|
key={`${key}-licontrol`} />;
|
||||||
}
|
}
|
||||||
case "dropDown": {
|
case "dropDown": {
|
||||||
return <DropDown item={control}
|
return <DropDown item={control}
|
||||||
state={this.props.state}
|
state={this.props.state}
|
||||||
onChangeState={this.props.onChangeState} />;
|
onChangeState={this.props.onChangeState}
|
||||||
|
key={`${key}-licontrol`} />;
|
||||||
}
|
}
|
||||||
case "section": {
|
case "section": {
|
||||||
return <Section item={control}
|
return <Section item={control}
|
||||||
state={this.props.state}
|
state={this.props.state}
|
||||||
onChangeState={this.props.onChangeState} />;
|
onChangeState={this.props.onChangeState}
|
||||||
|
key={`${key}-licontrol`} />;
|
||||||
}
|
}
|
||||||
case "link": {
|
case "link": {
|
||||||
return <Link item={control}
|
return <Link item={control}
|
||||||
state={this.props.state}
|
state={this.props.state}
|
||||||
onChangeState={this.props.onChangeState} />;
|
onChangeState={this.props.onChangeState}
|
||||||
|
key={`${key}-licontrol`} />;
|
||||||
}
|
}
|
||||||
case "slider": {
|
case "slider": {
|
||||||
return <Slider item={control}
|
return <Slider item={control}
|
||||||
state={this.props.state}
|
state={this.props.state}
|
||||||
onChangeState={this.props.onChangeState} />;
|
onChangeState={this.props.onChangeState}
|
||||||
|
key={`${key}-licontrol`} />;
|
||||||
}
|
}
|
||||||
case "text": {
|
case "text": {
|
||||||
return <Text item={control}
|
return <Text item={control}
|
||||||
state={this.props.state}
|
state={this.props.state}
|
||||||
onChangeState={this.props.onChangeState} />;
|
onChangeState={this.props.onChangeState}
|
||||||
|
key={`${key}-licontrol`} />;
|
||||||
}
|
}
|
||||||
case "progress": {
|
case "progress": {
|
||||||
return <Progress item={control}
|
return <Progress item={control}
|
||||||
state={this.props.state}
|
state={this.props.state}
|
||||||
onChangeState={this.props.onChangeState} />;
|
onChangeState={this.props.onChangeState}
|
||||||
|
key={`${key}-licontrol`} />;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue