File size: 1,837 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# Checklist

`Checklist` and `Task` are components used to render checklists.

## `Checklist` props

### `className { string }`

Additional class to add to the Checklist.

### `isPlaceholder { bool } - default: false`

Render as a placeholder.

### `onExpandTask { func }`

Function that is called when a task is expanded. The task's props are passed as argument.

## `Task` props

### `completed { bool }`

Whether the task is complete.

### `inProgress { bool }`

Whether the task is in progress.

### `onClick { Function }`

Handle the action button click.

### `onDismiss { func }`

Handle dismissal (or un-dismissal) click. Ignored for completed tasks.

### `buttonText { node } - default: "Do it!"`

Text to display in action button.

### `completedButtonText { node }`

Button text on complete.

### `completedTitle { node }`

Override title when completed (fallback to `title` prop)

### `description { node }`

Description

### `duration { string }`

Duration, like "2 minutes".

Translate as `translate( '%d minutes', '%d minutes', { count: 2, args: [ 2 ] } )`.

### `title { node }`

Task title

## Usage

A Checklist expects its children to be a flat list of Task:

```jsx
<Checklist>
	<Task
		onClick={ handleSplineClick }
		onDismiss={ handleSplineDismiss }
		title="Reticulate splines"
		buttonText="Reticulate!"
		completedTitle="Splines are reticulated 👍"
		description="Make sure that all the splines are reticulated."
		duration="1 minute"
		completed
	/>
	<Task
		onClick={ handleYakClick }
		onDismiss={ handleYakDismiss }
		title="Shave yaks!"
		buttonText="Buzzzz"
		completedTitle="Yaks shaved."
		description="Make sure you shave the yaks so you can get on with your life."
		duration="10,000 minutes"
	/>
	<Task title="Overwaxing banisters!" inProgress={ ! this.state.overwaxBanisters } />
</Checklist>;
```