forked from adobe/react-spectrum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCompleted.js
37 lines (31 loc) · 1.2 KB
/
Completed.js
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
import Delete from '@spectrum-icons/workflow/Delete';
import {AlertDialog, DialogTrigger, ActionButton} from '@adobe/react-spectrum'
import {Checkbox} from '@adobe/react-spectrum'
import {Flex} from '@adobe/react-spectrum'
function Completed(props){
const elements = props.completed.map(item => (
<Checkbox isReadOnly isSelected key={item.id}>{item.task}</Checkbox>
))
let alertCancel = () => alert('Cancel button pressed.');
return (
<Flex direction="column">
{elements}
<DialogTrigger>
<ActionButton marginTop="size-100" marginEnd="auto">
<Delete aria-label="Delete"/>
</ActionButton>
<AlertDialog
variant="confirmation"
title="Delete Items"
primaryActionLabel="Delete"
cancelLabel="Cancel"
autoFocusButton="primary"
onPrimaryAction={props.onDelete}
onCancel={alertCancel}>
Are you sure you want to delete the completed tasks?
</AlertDialog>
</DialogTrigger>
</Flex>
)
}
export default Completed;