File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
01-react-css3/solution/components Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 1
1
import React , { Component , PropTypes } from 'react'
2
2
import classnames from 'classnames'
3
3
import '../../../public/workshop/css/button.css'
4
+ import '../../../public/workshop/css/button-icons.css'
4
5
5
6
export const Button = ( {
7
+ icon,
6
8
classNames,
7
9
depressed,
8
10
disabled,
@@ -11,8 +13,9 @@ export const Button = ({
11
13
...otherProps
12
14
} ) => {
13
15
14
- const buttonClassNames = classnames ( 'btn' , classNames ,
15
- {
16
+ const buttonClassNames = classnames ( 'btn' , classNames ,
17
+ {
18
+ [ `icon icon-${ icon } ` ] : icon ,
16
19
'depressed' : depressed ,
17
20
'disabled' : disabled
18
21
}
Original file line number Diff line number Diff line change 1
1
import React , { Component , PropTypes } from 'react'
2
2
import { Button } from './index'
3
- import '../../../public/workshop/css/button-icons.css'
4
3
import '../../../public/workshop/css/button-add-to-cart.css'
5
4
6
5
export class ButtonAddToCart extends Component {
@@ -29,7 +28,8 @@ export class ButtonAddToCart extends Component {
29
28
30
29
return (
31
30
< Button
32
- classNames = "icon icon-add button_add_to_cart"
31
+ icon = "add"
32
+ classNames = "button_add_to_cart"
33
33
depressed = { depressed }
34
34
disabled = { disabled }
35
35
onClick = { this . onButtonClicked }
You can’t perform that action at this time.
0 commit comments