Skip to content

Commit

Permalink
Merge pull request #2964 from oliviertassinari/flat-button-fix-memory…
Browse files Browse the repository at this point in the history
…-shared

[FlatButton] Fix shared memory property modification
  • Loading branch information
alitaheri committed Jan 17, 2016
2 parents a99f624 + d31557b commit e964506
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/buttons/flat-button-label.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ const FlatButtonLabel = React.createClass({

const mergedRootStyles = this.mergeStyles({
position: 'relative',
padding: '0 ' + contextKeys.spacingDesktopGutterLess + 'px',
paddingLeft: contextKeys.spacingDesktopGutterLess,
paddingRight: contextKeys.spacingDesktopGutterLess,
}, style);

return (
Expand Down
7 changes: 4 additions & 3 deletions src/flat-button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ const FlatButton = React.createClass({
}, style);

let iconCloned;
const labelStyleIcon = {};

if (icon) {
iconCloned = React.cloneElement(icon, {
Expand All @@ -279,14 +280,14 @@ const FlatButton = React.createClass({
});

if (labelPosition === 'before') {
labelStyle.paddingRight = 8;
labelStyleIcon.paddingRight = 8;
} else {
labelStyle.paddingLeft = 8;
labelStyleIcon.paddingLeft = 8;
}
}

const labelElement = label ? (
<FlatButtonLabel label={label} style={labelStyle} />
<FlatButtonLabel label={label} style={mergeStyles(labelStyle, labelStyleIcon)} />
) : undefined;

// Place label before or after children.
Expand Down

0 comments on commit e964506

Please sign in to comment.