Skip to content

Commit 25cef10

Browse files
committed
Adjust button padding depending on label existence
1 parent d3b5eac commit 25cef10

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

src/components/button/button.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export const Button = ({
2424
flavour={flavour}
2525
textTransform={textTransform}
2626
hasIcon={!!icon || isLoading}
27+
hasLabel={!!children}
2728
onClick={isLoading ? undefined : onClick}
2829
ref={ref}
2930
iconColor={iconColor}

src/components/button/styled.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,13 @@ const colorsByFlavour = ({ flavour = DEFAULT, danger, warning, iconColor }) => {
123123

124124
export const StyledButton = styled.button.attrs(
125125
({ groupFirst, groupLast, groupMiddle, ...props }) => ({
126-
padding: props.large ? [1.5, 4] : [1, 3],
126+
padding: props.large
127+
? !props.hasLabel
128+
? [1.5, 3]
129+
: [1.5, 4]
130+
: !props.hasLabel
131+
? [1, 1.5]
132+
: [1, 3],
127133
colors: colorsByFlavour(props),
128134
round: groupFirst
129135
? { side: "left", size: 0.5 }

0 commit comments

Comments
 (0)