Revize c0b66eaf
Přidáno uživatelem Václav Honzík před asi 2 roky(ů)
frontend/src/features/Reusables/ButtonOpenableDialog.tsx | ||
---|---|---|
10 | 10 |
buttonVariant: 'text' | 'outlined' | 'contained' // the variant of the button that opens the dialog |
11 | 11 |
children: ReactNode // the content of the dialog |
12 | 12 |
maxWidth?: 'xs' | 'sm' | 'md' | 'lg' // the max width of the dialog |
13 |
open: boolean,
|
|
13 |
open: boolean |
|
14 | 14 |
setOpen: (open: boolean) => void |
15 | 15 |
size?: 'small' | 'medium' | 'large' |
16 |
startIcon?: ReactNode // the icon to the left of the button |
|
17 |
endIcon?: ReactNode // the icon to the right of the button |
|
16 | 18 |
} |
17 | 19 |
|
18 |
|
|
19 | 20 |
// Generic dialog that can be opened by a button and closed by clicking on the backdrop. |
20 | 21 |
const ButtonOpenableDialog: FunctionComponent<ButtonOpenableDialogProps> = ({ |
21 | 22 |
onOpenCallback, |
... | ... | |
27 | 28 |
maxWidth, |
28 | 29 |
open, |
29 | 30 |
setOpen, |
30 |
size |
|
31 |
size, |
|
32 |
startIcon, |
|
33 |
endIcon, |
|
31 | 34 |
}) => { |
32 |
|
|
33 | 35 |
// Change maxWidth to large if its undefined |
34 | 36 |
maxWidth = maxWidth ?? 'lg' |
35 | 37 |
|
... | ... | |
55 | 57 |
color={buttonColor} |
56 | 58 |
variant={buttonVariant} |
57 | 59 |
size={size ?? 'medium'} |
60 |
startIcon={startIcon} |
|
61 |
endIcon={endIcon} |
|
58 | 62 |
> |
59 | 63 |
{buttonText} |
60 | 64 |
</Button> |
61 |
<Dialog |
|
62 |
fullWidth |
|
63 |
open={open} |
|
64 |
onClose={onClose} |
|
65 |
maxWidth={maxWidth} |
|
66 |
> |
|
65 |
<Dialog fullWidth open={open} onClose={onClose} maxWidth={maxWidth}> |
|
67 | 66 |
{children} |
68 | 67 |
</Dialog> |
69 | 68 |
</Fragment> |
Také k dispozici: Unified diff
map icon colors start
re #9741