-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathButton.js
108 lines (93 loc) · 2.19 KB
/
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
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
var React = require('react');
var cx = require('classnames');
const { oneOf, bool } = React.PropTypes;
class Button extends React.Component {
render() {
const { size, busy, block, className } = this.props;
const classes = cx(styles.default, styles[size], block && styles.block, className);
return <button {...this.props} className={classes} disabled={busy} />;
}
}
Button.propTypes = {
size: oneOf(['large', 'small']),
block: bool,
busy: bool
};
const styles = cssInJS({
default: {
display: 'inline-block',
padding: '6px 12px',
marginBottom: 0,
fontSize: 14,
fontWeight: 'normal',
lineHeight: 1.5,
textAlign: 'center',
whiteSpace: 'nowrap',
verticalAlign: 'middle',
touchAction: 'manipulation',
cursor: 'pointer',
userSelect: 'none',
backgroundImage: 'none',
border: '1px solid transparent',
borderRadius: 4,
color: '#fff',
backgroundColor: '#337ab7',
borderColor: '#2e6da4',
'@media only screen and (max-width: 640px)': {
display: 'block',
width: '100%'
},
':focus': {
color: '#fff',
backgroundColor: '#286090',
borderColor: '#122b40',
outline: 'thin dotted',
outlineOffset: -2
},
':hover': {
color: '#fff',
backgroundColor: '#286090',
borderColor: '#204d74',
textDecoration: 'none'
},
':active': {
color: '#fff',
backgroundColor: '#286090',
borderColor: '#204d74',
backgroundImage: 'none',
outline: 0,
boxShadow: 'inset 0 3px 5px rgba(0, 0, 0, .125)',
':hover': {
color: '#fff',
backgroundColor: '#204d74',
borderColor: '#122b40'
}
},
'[disabled]': {
backgroundColor: '#337ab7',
borderColor: '#2e6da4',
cursor: 'not-allowed',
filter: 'alpha(opacity=65)',
boxShadow: 'none',
opacity: .65,
pointerEvents: 'none'
}
},
large: {
padding: '10px 16px',
fontSize: 18,
lineHeight: 1.33,
borderRadius: 6
},
small: {
padding: '5px 10px',
fontSize: 12,
lineHeight: 1.5,
borderRadius: 3
},
block: {
display: 'block',
width: '100%'
}
});
module.exports = Button;