Projekt

Obecné

Profil

Stáhnout (1.36 KB) Statistiky
| Větev: | Tag: | Revize:
1 b225ffee Fantič
import { AlertDialog, Button } from "native-base";
2
3
export const ConfirmDialog = (props: { isShown: boolean, headerText?: string, bodyText?: string, confirmText?: string, confirmColor?: string, cancelRef?: any, onClose?: any, onSubmit?: any }): JSX.Element => (
4
    <>
5
        {props.isShown &&
6
            <AlertDialog leastDestructiveRef={props.cancelRef} isOpen={true} onClose={props.onClose}>
7
                <AlertDialog.Content>
8
                    <AlertDialog.CloseButton />
9
                    <AlertDialog.Header>{props.headerText}</AlertDialog.Header>
10
                    {props.bodyText &&
11
                        <AlertDialog.Body>
12
                            {props.bodyText}
13
                        </AlertDialog.Body>
14
                    }
15
                    <AlertDialog.Footer>
16
                        <Button.Group space={2}>
17
                            <Button variant="unstyled" colorScheme="coolGray" onPress={props.onClose} ref={props.cancelRef}>
18
                                Cancel
19
                            </Button>
20
                            <Button colorScheme={props.confirmColor} onPress={props.onSubmit}>
21
                                {props.confirmText}
22
                            </Button>
23
                        </Button.Group>
24
                    </AlertDialog.Footer>
25
                </AlertDialog.Content>
26
            </AlertDialog>}
27
    </>
28
29
)