Create sharing dialog root
[arvados-workbench2.git] / src / views-components / sharing-dialog / sharing-dialog-component.tsx
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import * as React from 'react';
6 import { Dialog, DialogTitle, Button, Grid, DialogContent } from '@material-ui/core';
7 import { DialogActions } from '~/components/dialog-actions/dialog-actions';
8
9
10 export interface SharingDialogDataProps {
11     open: boolean;
12     saveEnabled: boolean;
13     children: React.ReactNode;
14 }
15 export interface SharingDialogActionProps {
16     onClose: () => void;
17     onSave: () => void;
18     onAdvanced: () => void;
19 }
20 export default (props: SharingDialogDataProps & SharingDialogActionProps) => {
21     const { children, open, saveEnabled, onAdvanced, onClose, onSave } = props;
22     return <Dialog
23         {...{ open, onClose }}
24         fullWidth
25         maxWidth='sm'>
26         <DialogTitle>
27             Sharing settings
28             </DialogTitle>
29         <DialogContent>
30             {children}
31         </DialogContent>
32         <DialogActions>
33             <Grid container spacing={8}>
34                 <Grid item>
35                     <Button
36                         color='primary'
37                         onClick={onAdvanced}>
38                         Advanced
39                     </Button>
40                 </Grid>
41                 <Grid item xs />
42                 <Grid item>
43                     <Button onClick={onClose}>
44                         Close
45                     </Button>
46                 </Grid>
47                 <Grid item>
48                     <Button
49                         variant='contained'
50                         color='primary'
51                         onClick={onSave}
52                         disabled={!saveEnabled}>
53                         Save
54                     </Button>
55                 </Grid>
56             </Grid>
57         </DialogActions>
58     </Dialog>;
59 };