use render callbacks for loading notification

This commit is contained in:
Rick Watson
2019-08-09 18:55:11 +01:00
parent ff85c2e661
commit ef8061cbc3
12 changed files with 103 additions and 80 deletions

View File

@ -17,7 +17,7 @@ class DemoController extends Component {
componentDidMount() {
this.props.loadData();
}
render() {
const { data, fetched, errorMessage, saveData, loadData, handleValueChange } = this.props;
return (
@ -25,14 +25,16 @@ class DemoController extends Component {
<LoadingNotification
onReset={loadData}
fetched={fetched}
errorMessage={errorMessage}>
<DemoControllerForm
demoSettings={data}
onReset={loadData}
onSubmit={saveData}
handleValueChange={handleValueChange}
/>
</LoadingNotification>
errorMessage={errorMessage}
render={() =>
<DemoControllerForm
demoSettings={data}
onReset={loadData}
onSubmit={saveData}
handleValueChange={handleValueChange}
/>
}
/>
</SectionContent>
)
}
@ -43,11 +45,11 @@ const useStyles = makeStyles(theme => ({
marginRight: theme.spacing(2),
marginTop: theme.spacing(2),
},
blinkSpeedLabel:{
blinkSpeedLabel: {
marginBottom: theme.spacing(5),
}
}));
function DemoControllerForm(props) {
const { demoSettings, onSubmit, onReset, handleValueChange } = props;
const classes = useStyles();