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
72 changes: 39 additions & 33 deletions src/components/button/__snapshots__/button.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ exports[`Borderless Button renders 1`] = `
align-items: center;
position: relative;
font-weight: 500;
font-size: 14px;
font-size: 12px;
white-space: nowrap;
word-break: keep-all;
cursor: pointer;
pointer-events: auto;
padding: 8px;
padding: 4px 12px;
transition: all 150ms;
background-color: rgba(255,255,255,0.0);
color: #00AB44;
border-width: 1px;
border-style: solid;
border-color: rgba(255,255,255,0.0);
border-radius: 4px;
border-radius: 2px;
box-sizing: border-box;
text-decoration: none;
}
Expand Down Expand Up @@ -56,8 +56,8 @@ exports[`Borderless Button renders 1`] = `
}

.c0.c0 .button-icon {
height: 16px;
width: 16px;
height: 14px;
width: 14px;
fill: #00AB44;
}

Expand All @@ -79,7 +79,8 @@ exports[`Borderless Button renders 1`] = `
class="c0"
colors="[object Object]"
flavour="borderless"
padding="2"
padding="1,3"
round="0.5"
texttransform="firstLetter"
>
<span>
Expand All @@ -95,19 +96,19 @@ exports[`Button states renders loading icon 1`] = `
align-items: center;
position: relative;
font-weight: 500;
font-size: 14px;
font-size: 12px;
white-space: nowrap;
word-break: keep-all;
cursor: pointer;
pointer-events: auto;
padding: 8px;
padding: 4px 12px;
transition: all 150ms;
background-color: #00AB44;
color: #F6F7F7;
border-width: 1px;
border-style: solid;
border-color: #00AB44;
border-radius: 4px;
border-radius: 2px;
box-sizing: border-box;
text-decoration: none;
}
Expand Down Expand Up @@ -144,8 +145,8 @@ exports[`Button states renders loading icon 1`] = `
}

.c0.c0 .button-icon {
height: 16px;
width: 16px;
height: 14px;
width: 14px;
fill: #F6F7F7;
}

Expand Down Expand Up @@ -180,7 +181,8 @@ exports[`Button states renders loading icon 1`] = `
<button
class="c0"
colors="[object Object]"
padding="2"
padding="1,3"
round="0.5"
texttransform="firstLetter"
>
<svg
Expand Down Expand Up @@ -216,19 +218,19 @@ exports[`Button states renders only icon 1`] = `
align-items: center;
position: relative;
font-weight: 500;
font-size: 14px;
font-size: 12px;
white-space: nowrap;
word-break: keep-all;
cursor: pointer;
pointer-events: auto;
padding: 8px;
padding: 4px 12px;
transition: all 150ms;
background-color: rgba(255,255,255,0.0);
color: #00AB44;
border-width: 1px;
border-style: solid;
border-color: #00AB44;
border-radius: 4px;
border-radius: 2px;
box-sizing: border-box;
text-decoration: none;
}
Expand Down Expand Up @@ -265,8 +267,8 @@ exports[`Button states renders only icon 1`] = `
}

.c0.c0 .button-icon {
height: 16px;
width: 16px;
height: 14px;
width: 14px;
fill: #00AB44;
}

Expand Down Expand Up @@ -305,7 +307,8 @@ exports[`Button states renders only icon 1`] = `
class="c0"
colors="[object Object]"
flavour="hollow"
padding="2"
padding="1,3"
round="0.5"
texttransform="firstLetter"
>
<div
Expand Down Expand Up @@ -346,7 +349,7 @@ exports[`Button states renders smaller only icon 1`] = `
border-width: 1px;
border-style: solid;
border-color: #00AB44;
border-radius: 4px;
border-radius: 2px;
box-sizing: border-box;
text-decoration: none;
}
Expand Down Expand Up @@ -383,8 +386,8 @@ exports[`Button states renders smaller only icon 1`] = `
}

.c0.c0 .button-icon {
height: 16px;
width: 16px;
height: 14px;
width: 14px;
fill: #00AB44;
}

Expand Down Expand Up @@ -424,6 +427,7 @@ exports[`Button states renders smaller only icon 1`] = `
colors="[object Object]"
flavour="hollow"
padding="1,3"
round="0.5"
texttransform="firstLetter"
>
<div
Expand Down Expand Up @@ -452,19 +456,19 @@ exports[`Default Button renders 1`] = `
align-items: center;
position: relative;
font-weight: 500;
font-size: 14px;
font-size: 12px;
white-space: nowrap;
word-break: keep-all;
cursor: pointer;
pointer-events: auto;
padding: 8px;
padding: 4px 12px;
transition: all 150ms;
background-color: #00AB44;
color: #F6F7F7;
border-width: 1px;
border-style: solid;
border-color: #00AB44;
border-radius: 4px;
border-radius: 2px;
box-sizing: border-box;
text-decoration: none;
}
Expand Down Expand Up @@ -497,8 +501,8 @@ exports[`Default Button renders 1`] = `
}

.c0.c0 .button-icon {
height: 16px;
width: 16px;
height: 14px;
width: 14px;
fill: #F6F7F7;
}

Expand All @@ -519,7 +523,8 @@ exports[`Default Button renders 1`] = `
<button
class="c0"
colors="[object Object]"
padding="2"
padding="1,3"
round="0.5"
texttransform="fullWidth"
>
<span>
Expand All @@ -535,19 +540,19 @@ exports[`Hollow Button renders 1`] = `
align-items: center;
position: relative;
font-weight: 500;
font-size: 14px;
font-size: 12px;
white-space: nowrap;
word-break: keep-all;
cursor: pointer;
pointer-events: auto;
padding: 8px;
padding: 4px 12px;
transition: all 150ms;
background-color: rgba(255,255,255,0.0);
color: #00AB44;
border-width: 1px;
border-style: solid;
border-color: #00AB44;
border-radius: 4px;
border-radius: 2px;
box-sizing: border-box;
text-decoration: none;
}
Expand Down Expand Up @@ -584,8 +589,8 @@ exports[`Hollow Button renders 1`] = `
}

.c0.c0 .button-icon {
height: 16px;
width: 16px;
height: 14px;
width: 14px;
fill: #00AB44;
}

Expand All @@ -607,7 +612,8 @@ exports[`Hollow Button renders 1`] = `
class="c0"
colors="[object Object]"
flavour="hollow"
padding="2"
padding="1,3"
round="0.5"
texttransform="firstLetter"
>
<span>
Expand Down
5 changes: 3 additions & 2 deletions src/components/button/button.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const RadioButtonGroup = args => {
<ButtonGroup
items={radioButtonItems.map(item => ({ ...args, ...item }))}
checked={checked}
buttonProps={args}
onChange={onChange}
/>
)
Expand All @@ -51,7 +52,7 @@ export default {
disabled: false,
danger: false,
warning: false,
small: false,
large: false,
neutral: false,
},
argTypes: {
Expand All @@ -68,7 +69,7 @@ export default {
disabled: { control: "boolean" },
danger: { control: "boolean" },
warning: { control: "boolean" },
small: { control: "boolean" },
large: { control: "boolean" },
neutral: { control: "boolean" },
},
}
4 changes: 2 additions & 2 deletions src/components/button/styled.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const colorsByFlavour = ({ flavour = DEFAULT, danger, warning, iconColor }) => {

export const StyledButton = styled.button.attrs(
({ groupFirst, groupLast, groupMiddle, ...props }) => ({
padding: props.padding || props.tiny ? [0.5, 1] : props.small ? [1, 3] : [2],
padding: props.large ? [1.5, 4] : [1, 3],
colors: colorsByFlavour(props),
round: groupFirst
? { side: "left", size: 0.5 }
Expand All @@ -143,7 +143,7 @@ export const StyledButton = styled.button.attrs(
${alignSelf};

font-weight: ${({ strong }) => (strong ? 700 : 500)};
font-size: ${({ small, tiny }) => (tiny ? "10px" : small ? "12px" : "14px")};
font-size: ${({ large }) => (large ? "16px" : "12px")};
white-space: nowrap;
word-break: keep-all;

Expand Down
12 changes: 6 additions & 6 deletions src/components/input/styled.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import styled, { css } from "styled-components"
import { Icon } from "@/components/icon"
import Flex from "@/components/templates/flex"
import { TextSmall, TextMicro } from "@/components/typography"
import { TextSmall } from "@/components/typography"
import { getColor, getValidatedControlColor } from "@/theme/utils"

const disabledCursorSupport = css`
Expand All @@ -22,19 +22,19 @@ export const Input = styled(Flex).attrs(props => ({
_focus: {
border: props.error ? "errorText" : "inputBorderFocus",
},
padding: props.size === "tiny" ? [0.5, 1] : props.size === "small" ? [1, 2] : [2, 3],
height: props.size === "tiny" ? 6 : props.size === "small" ? 7 : 9,
padding: [0.5, 1],
height: 6,
...props,
}))`
font-size: ${({ size }) => (size === "tiny" ? "11px" : size === "small" ? "12px" : "14px")};
font-size: 12px;
color: ${({ disabled, hasValue }) =>
hasValue ? getColor("text") : disabled ? getColor("placeholder") : getColor("textLite")};
${({ hasIconLeft }) => hasIconLeft && "padding-left: 24px;"}
${({ hasIconRight, hasIndicator }) =>
(hasIconRight || hasIndicator) && `padding-right: ${hasIconRight && hasIndicator ? 48 : 24}px;`}

&::placeholder {
font-size: ${({ size }) => (size === "tiny" ? "11px" : size === "small" ? "12px" : "14px")};
font-size: 12px;
color: ${getColor("placeholder")};
opacity: ${({ disabled }) => (disabled ? 0.4 : 1)};
font-weight: normal;
Expand All @@ -49,7 +49,7 @@ export const StyledLabel = styled.label`
${disabledCursorSupport};
`
export const LabelText = styled(Flex).attrs(props => ({
as: props.size === "tiny" ? TextMicro : TextSmall,
as: TextSmall,
strong: true,
alignItems: "center",
flex: false,
Expand Down
Loading