Roll back to basic view after closing the sharing dialog
[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     advancedEnabled: boolean;
14     children: React.ReactNode;
15 }
16 export interface SharingDialogActionProps {
17     onClose: () => void;
18     onExited: () => void;
19     onSave: () => void;
20     onAdvanced: () => void;
21 }
22 export default (props: SharingDialogDataProps & SharingDialogActionProps) => {
23     const { children, open, advancedEnabled, saveEnabled, onAdvanced, onClose, onExited, onSave } = props;
24     return <Dialog
25         {...{ open, onClose, onExited }}
26         fullWidth
27         maxWidth='sm'>
28         <DialogTitle>
29             Sharing settings
30             </DialogTitle>
31         <DialogContent>
32             {children}
33         </DialogContent>
34         <DialogActions>
35             <Grid container spacing={8}>
36                 {advancedEnabled &&
37                     <Grid item>
38                         <Button
39                             color='primary'
40                             onClick={onAdvanced}>
41                             Advanced
42                     </Button>
43                     </Grid>
44                 }
45                 <Grid item xs />
46                 <Grid item>
47                     <Button onClick={onClose}>
48                         Close
49                     </Button>
50                 </Grid>
51                 <Grid item>
52                     <Button
53                         variant='contained'
54                         color='primary'
55                         onClick={onSave}
56                         disabled={!saveEnabled}>
57                         Save
58                     </Button>
59                 </Grid>
60             </Grid>
61         </DialogActions>
62     </Dialog>;
63 };