forked from cypress-io/testing-workshop-cypress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFooter.jsx
66 lines (63 loc) · 1.68 KB
/
Footer.jsx
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
import React from 'react'
import pluralize from 'pluralize'
import cx from 'classnames'
import { filters } from './filters'
class Footer extends React.Component {
render () {
var activeTodoWord = pluralize('item', this.props.count, false)
var clearButton = null
if (this.props.completedCount > 0) {
clearButton = (
<button
className='clear-completed'
onClick={this.props.onClearCompleted}
>
Clear completed
</button>
)
}
// React idiom for shortcutting to `classSet` since it'll be used often
// var cx = React.addons.classSet
var nowShowing = this.props.nowShowing
return (
<footer className='footer'>
<span className='todo-count'>
<strong>{this.props.count}</strong> {activeTodoWord} left
</span>
<ul className='filters'>
<li>
<a
href='#/'
data-cy='show-all'
className={cx({ selected: nowShowing === filters.ALL_TODOS })}
>
All
</a>
</li>{' '}
<li>
<a
href='#/active'
data-cy='show-active'
className={cx({ selected: nowShowing === filters.ACTIVE_TODOS })}
>
Active
</a>
</li>{' '}
<li>
<a
href='#/completed'
data-cy='show-completed'
className={cx({
selected: nowShowing === filters.COMPLETED_TODOS
})}
>
Completed
</a>
</li>
</ul>
{clearButton}
</footer>
)
}
}
export default Footer