-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathconfirmationmodal_variants.tsx
More file actions
51 lines (45 loc) · 1.17 KB
/
confirmationmodal_variants.tsx
File metadata and controls
51 lines (45 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { useState } from 'react'
import { Button, ConfirmationModal, Text } from '@vtex/shoreline'
export function DefaultConfirmationModal() {
const [open, setOpen] = useState(false)
const handleClose = () => {
setOpen(false)
}
return (
<>
<Button onClick={() => setOpen(true)}>Open Confirmation Modal</Button>
<ConfirmationModal
open={open}
onClose={handleClose}
onConfirm={handleClose}
onCancel={handleClose}
>
<Text variant="body">Are you sure you want to proceed?</Text>
</ConfirmationModal>
</>
)
}
export function ConfirmationModalWithCustomText() {
const [open, setOpen] = useState(false)
const handleClose = () => {
setOpen(false)
}
return (
<>
<Button onClick={() => setOpen(true)}>
Open Custom Confirmation Modal
</Button>
<ConfirmationModal
open={open}
onClose={handleClose}
onConfirm={handleClose}
onCancel={handleClose}
>
<Text variant="body">
This action cannot be undone. Are you absolutely sure you want to
delete this item?
</Text>
</ConfirmationModal>
</>
)
}