Confirmation dialog: upgrade material-ui.

master
Tom Hacohen 6 years ago
parent eac0508194
commit bc46c197ba

@ -1,43 +1,44 @@
import * as React from 'react'; import * as React from 'react';
import Dialog from 'material-ui/Dialog'; import Dialog from '@material-ui/core/Dialog';
import FlatButton from 'material-ui/FlatButton'; import DialogContent from '@material-ui/core/DialogContent';
import DialogActions from '@material-ui/core/DialogActions';
import Button from '@material-ui/core/Button';
import { pure } from 'recompose'; import { pure } from 'recompose';
export default pure((_props: any) => { export default pure((_props: any) => {
const { const {
children,
onCancel, onCancel,
onOk, onOk,
labelOk, labelOk,
...props ...props
} = _props; } = _props;
const actions = [
(
<FlatButton
key="1"
label="Cancel"
primary={true}
onClick={onCancel}
/>
)
,
(
<FlatButton
key="2"
label={labelOk || 'Confirm'}
primary={true}
onClick={onOk}
/>
),
];
return ( return (
<Dialog <Dialog
actions={actions}
modal={false} modal={false}
onRequestClose={onCancel} onRequestClose={onCancel}
{...props} {...props}
/> >
<DialogContent>
{children}
</DialogContent>
<DialogActions>
<Button
color="primary"
onClick={onCancel}
>
Cancel
</Button>
<Button
color="primary"
onClick={onOk}
>
{labelOk || 'Confirm'}
</Button>
</DialogActions>
</Dialog>
); );
}); });

Loading…
Cancel
Save