Skip to content

Commit

Permalink
fix(Button): preserve icon gap with box-sizing: border-box (#2928)
Browse files Browse the repository at this point in the history
  • Loading branch information
JackUait committed Jul 11, 2022
1 parent 230e15d commit a244b39
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions packages/react-ui/components/Button/Button.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -626,15 +626,15 @@ export const styles = memoizeStyle({
`;
},

iconNoRightPadding() {
iconNoRightMargin() {
return css`
padding-right: 0;
margin-right: 0;
`;
},

iconLink(t: Theme) {
return css`
padding-right: ${t.btnLinkIconMarginRight};
margin-right: ${t.btnLinkIconMarginRight};
`;
},

Expand Down Expand Up @@ -665,19 +665,19 @@ export const styles = memoizeStyle({
iconSmall(t: Theme) {
return css`
width: ${t.btnIconSizeSmall};
padding-right: ${t.btnIconGapSmall};
margin-right: ${t.btnIconGapSmall};
`;
},
iconMedium(t: Theme) {
return css`
width: ${t.btnIconSizeMedium};
padding-right: ${t.btnIconGapMedium};
margin-right: ${t.btnIconGapMedium};
`;
},
iconLarge(t: Theme) {
return css`
width: ${t.btnIconSizeLarge};
padding-right: ${t.btnIconGapLarge};
margin-right: ${t.btnIconGapLarge};
`;
},

Expand Down
2 changes: 1 addition & 1 deletion packages/react-ui/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ export class Button extends React.Component<ButtonProps, ButtonState> {
iconNode = (
<span
className={cx(styles.icon(), this.getSizeIconClassName(), {
[styles.iconNoRightPadding()]: !children,
[styles.iconNoRightMargin()]: !children,
[styles.iconLink(this.theme)]: isLink,
})}
>
Expand Down

0 comments on commit a244b39

Please sign in to comment.