Skip to content

Commit 37cbc1d

Browse files
author
Nick Baroni
committed
Removed px, consolidated getStyle functions.
1 parent 5c0b068 commit 37cbc1d

File tree

1 file changed

+20
-29
lines changed

1 file changed

+20
-29
lines changed

src/badge.jsx

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -38,69 +38,60 @@ export default React.createClass({
3838
muiTheme: newMuiTheme,
3939
});
4040
},
41-
_getBackgroundColor() {
42-
return this.props.backgroundColor
41+
getThemeBadge() {
42+
return this.state.muiTheme.badge;
43+
},
44+
getTheme() {
45+
return this.state.muiTheme.raisedButton;
46+
},
47+
getStyles() {
48+
const backgroundColor = this.props.backgroundColor
4349
? this.props.backgroundColor
4450
: this.props.primary
4551
? this.getTheme().primaryColor
4652
: this.props.secondary
4753
? this.getTheme().secondaryColor
4854
: this.getTheme().color;
49-
},
50-
_getLabelColor() {
51-
return this.props.labelColor
55+
56+
const labelColor = this.props.labelColor
5257
? this.props.labelColor
5358
: this.props.primary
5459
? this.getTheme().primaryTextColor
5560
: this.props.secondary
5661
? this.getTheme().secondaryTextColor
5762
: this.getTheme().textColor;
58-
},
59-
getThemeBadge() {
60-
return this.state.muiTheme.badge;
61-
},
62-
getTheme() {
63-
return this.state.muiTheme.raisedButton;
64-
},
65-
getStyles() {
63+
6664
const style = {
6765
root: {
6866
backgroundColor: 'none',
6967
position: 'relative',
7068
display: 'inline-block',
71-
marginRight: '20px',
69+
marginRight: '20',
7270
},
7371
badge: {
74-
display: '-webkit-box; display: -webkit-flex; display: flex',
72+
display: 'flex',
7573
WebkitBoxOrient: 'horizontal',
7674
WebkitBoxDirection: 'normal',
77-
WebkitFlexDirection: 'row',
78-
msFlexDirection: 'row',
7975
flexDirection: 'row',
80-
WebkitFlexWrap: 'wrap',
81-
msFlexWrap: 'wrap',
8276
flexWrap: 'wrap',
8377
WebkitBoxPack: 'center',
84-
WebkitJustifyContent: 'center',
8578
msFlexPack: 'center',
8679
justifyContent: 'center',
87-
WebkitAlignContent: 'center',
8880
msFlexLinePack: 'center',
8981
alignContent: 'center',
9082
WebkitBoxAlign: 'center',
91-
WebkitAlignItems: 'center',
9283
msFlexAlign: 'center',
9384
alignItems: 'center',
9485
position: 'absolute',
95-
top: '-11px',
96-
right: '-24px',
86+
top: '-11',
87+
right: '-24',
9788
fontWeight: Typography.fontWeightMedium,
98-
fontSize: '12px',
99-
width: '22px',
100-
height: '22px',
89+
fontSize: '12',
90+
width: '22',
91+
height: '22',
10192
borderRadius: '50%',
102-
backgroundColor: this._getBackgroundColor(),
103-
color: this._getLabelColor(),
93+
backgroundColor: backgroundColor,
94+
color: labelColor,
10495
},
10596
};
10697
for (let item in (this.props.style || {})) {

0 commit comments

Comments
 (0)