Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/components/button/__snapshots__/button.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ exports[`Button states renders only icon 1`] = `
word-break: keep-all;
cursor: pointer;
pointer-events: auto;
padding: 4px 12px;
padding: 4px 6px;
transition: all 150ms;
background-color: rgba(255,255,255,0.0);
color: #00AB44;
Expand Down Expand Up @@ -307,7 +307,7 @@ exports[`Button states renders only icon 1`] = `
class="c0"
colors="[object Object]"
flavour="hollow"
padding="1,3"
padding="1,1.5"
round="0.5"
texttransform="firstLetter"
>
Expand Down Expand Up @@ -342,7 +342,7 @@ exports[`Button states renders smaller only icon 1`] = `
word-break: keep-all;
cursor: pointer;
pointer-events: auto;
padding: 4px 12px;
padding: 4px 6px;
transition: all 150ms;
background-color: rgba(255,255,255,0.0);
color: #00AB44;
Expand Down Expand Up @@ -426,7 +426,7 @@ exports[`Button states renders smaller only icon 1`] = `
class="c0"
colors="[object Object]"
flavour="hollow"
padding="1,3"
padding="1,1.5"
round="0.5"
texttransform="firstLetter"
>
Expand Down
1 change: 1 addition & 0 deletions src/components/button/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const Button = ({
flavour={flavour}
textTransform={textTransform}
hasIcon={!!icon || isLoading}
hasLabel={!!children}
onClick={isLoading ? undefined : onClick}
ref={ref}
iconColor={iconColor}
Expand Down
8 changes: 7 additions & 1 deletion src/components/button/styled.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,13 @@ const colorsByFlavour = ({ flavour = DEFAULT, danger, warning, iconColor }) => {

export const StyledButton = styled.button.attrs(
({ groupFirst, groupLast, groupMiddle, ...props }) => ({
padding: props.large ? [1.5, 4] : [1, 3],
padding: props.large
? !props.hasLabel
? [1.5, 3]
: [1.5, 4]
: !props.hasLabel
? [1, 1.5]
: [1, 3],
colors: colorsByFlavour(props),
round: groupFirst
? { side: "left", size: 0.5 }
Expand Down