Skip to content

Commit fd5329f

Browse files
Make SVG size in buttons smaller
1 parent 3d82fae commit fd5329f

2 files changed

Lines changed: 33 additions & 4 deletions

File tree

src/components/Button.stories.tsx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,35 @@ export const Sizes = () => (
4343
</>
4444
);
4545

46+
export const ContainsSVG = () => (
47+
<>
48+
<Button appearance="secondary">
49+
<Icon icon="lock" />
50+
Default
51+
</Button>
52+
<Button appearance="secondary" size="small">
53+
<Icon icon="lock" />
54+
Small
55+
</Button>
56+
<Button appearance="secondary">
57+
<Icon icon="check" />
58+
Default
59+
</Button>
60+
<Button appearance="secondary" size="small">
61+
<Icon icon="check" />
62+
Small
63+
</Button>
64+
<Button appearance="secondary">
65+
<Icon icon="grid" />
66+
Default
67+
</Button>
68+
<Button appearance="secondary" size="small">
69+
<Icon icon="grid" />
70+
Small
71+
</Button>
72+
</>
73+
);
74+
4675
export const Loading = () => (
4776
<>
4877
<Button appearance="primary" isLoading>

src/components/Button.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,12 @@ export const StyledButton = styled.button<StylingProps & { children: ReactElemen
8888
}
8989
9090
svg {
91-
height: ${(props) => (props.size === SIZES.SMALL ? '14' : '16')}px;
92-
width: ${(props) => (props.size === SIZES.SMALL ? '14' : '16')}px;
91+
height: ${(props) => (props.size === SIZES.SMALL ? '12' : '14')}px;
92+
width: ${(props) => (props.size === SIZES.SMALL ? '12' : '14')}px;
9393
vertical-align: top;
9494
margin-right: ${(props) => (props.size === SIZES.SMALL ? '4' : '6')}px;
95-
margin-top: ${(props) => (props.size === SIZES.SMALL ? '-1' : '-2')}px;
96-
margin-bottom: ${(props) => (props.size === SIZES.SMALL ? '-1' : '-2')}px;
95+
margin-top: ${(props) => (props.size === SIZES.SMALL ? '0' : '-1')}px;
96+
margin-bottom: ${(props) => (props.size === SIZES.SMALL ? '0' : '-2')}px;
9797
9898
/* Necessary for js mouse events to not glitch out when hovering on svgs */
9999
pointer-events: none;

0 commit comments

Comments
 (0)