-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathButton.js
37 lines (32 loc) · 855 Bytes
/
Button.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 React, { Component } from 'react'
import { styled } from 'styletron-react'
const StyledButton = styled('button', ({ depressed }) => ({
display: 'inline-block',
outline: 'none',
textAlign: 'center',
font: 'bold 32px helvetica',
padding: '20px 40px',
border: '0',
cursor: 'pointer',
color: depressed ? '#848484' : '#fff',
backgroundColor: depressed ? '#bebebe' : '#ec4800',
transition: 'all 300ms',
':hover': {
backgroundColor: depressed ? '#bebebe' : '#f98d00'
}
}))
export class Button extends Component {
state = { depressed: false }
onButtonClicked = () => this.setState({
depressed: !this.state.depressed
})
render () {
return (
<StyledButton
depressed={ this.state.depressed }
onClick={ this.onButtonClicked }
{ ...this.props }>
</StyledButton>
)
}
}