File tree 1 file changed +5
-17
lines changed
04-aphrodite/button/Button
1 file changed +5
-17
lines changed Original file line number Diff line number Diff line change 1
1
import React , { Component } from 'react'
2
2
import { css , StyleSheet } from 'aphrodite'
3
- import classnames from 'classnames'
4
3
5
4
const styles = StyleSheet . create ( {
6
5
btn : {
@@ -14,17 +13,13 @@ const styles = StyleSheet.create({
14
13
color : '#fff' ,
15
14
backgroundColor : '#ec4800' ,
16
15
transition : 'all 300ms' ,
17
- } ,
18
- depressed : {
19
- color : '#848484' ,
20
- backgroundColor : '#bebebe' ,
21
- } ,
22
- hover : {
23
16
':hover' : {
24
17
backgroundColor : '#f98d00'
25
18
}
26
19
} ,
27
- hoverDepressed : {
20
+ depressed : {
21
+ color : '#848484' ,
22
+ backgroundColor : '#bebebe' ,
28
23
':hover' : {
29
24
backgroundColor : '#bebebe'
30
25
}
@@ -40,17 +35,10 @@ export class Button extends Component {
40
35
} )
41
36
42
37
render ( ) {
43
- const normalClassnames = css ( styles . btn , styles . hover , styles . hover . depressed )
44
- const depressedClassnames = css ( styles . depressed , styles . hoverDepressed )
45
- const buttonClassNames = classnames ( normalClassnames ,
46
- {
47
- [ depressedClassnames ] : this . state . depressed
48
- }
49
- )
50
-
38
+ const { depressed } = this . state
51
39
return (
52
40
< button
53
- className = { buttonClassNames }
41
+ className = { css ( styles . btn , depressed && styles . depressed ) }
54
42
onClick = { this . onButtonClicked }
55
43
{ ...this . props } >
56
44
</ button >
You can’t perform that action at this time.
0 commit comments