Confirmation dialog: upgrade material-ui.
parent
eac0508194
commit
bc46c197ba
@ -1,43 +1,44 @@
|
||||
import * as React from 'react';
|
||||
|
||||
import Dialog from 'material-ui/Dialog';
|
||||
import FlatButton from 'material-ui/FlatButton';
|
||||
import Dialog from '@material-ui/core/Dialog';
|
||||
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';
|
||||
|
||||
export default pure((_props: any) => {
|
||||
const {
|
||||
children,
|
||||
onCancel,
|
||||
onOk,
|
||||
labelOk,
|
||||
...props
|
||||
} = _props;
|
||||
const actions = [
|
||||
(
|
||||
<FlatButton
|
||||
key="1"
|
||||
label="Cancel"
|
||||
primary={true}
|
||||
onClick={onCancel}
|
||||
/>
|
||||
)
|
||||
,
|
||||
(
|
||||
<FlatButton
|
||||
key="2"
|
||||
label={labelOk || 'Confirm'}
|
||||
primary={true}
|
||||
onClick={onOk}
|
||||
/>
|
||||
),
|
||||
];
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
actions={actions}
|
||||
modal={false}
|
||||
onRequestClose={onCancel}
|
||||
{...props}
|
||||
/>
|
||||
>
|
||||
<DialogContent>
|
||||
{children}
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button
|
||||
color="primary"
|
||||
onClick={onCancel}
|
||||
>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button
|
||||
color="primary"
|
||||
onClick={onOk}
|
||||
>
|
||||
{labelOk || 'Confirm'}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
);
|
||||
});
|
||||
|
Loading…
Reference in New Issue