Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colour refactored to use Alta's #8110

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from
1 change: 0 additions & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"@storybook/core-server": "^7.6.17",
"jest": "29.7.0",
"phosphor-react": "^1.4.1",
"polished": "^4.2.2",
"postinstall-postinstall": "^2.0.0",
"react": "18.3.1",
"react-dom": "18.3.1",
Expand Down
14 changes: 7 additions & 7 deletions packages/components/src/Alert/Alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ const Container = styled.div<{
$type?: AlertType
}>`
--color: ${({ $type, theme }) => `
${$type === 'success' ? theme.colors.positiveDark : ''}
${$type === 'loading' ? theme.colors.primaryDark : ''}
${$type === 'info' ? theme.colors.tealDark : ''}
${$type === 'error' ? theme.colors.negativeDark : ''}
${$type === 'warning' ? theme.colors.orangeDark : ''}
${$type === undefined ? theme.colors.positiveDark : ''}
${$type === 'success' ? theme.colors.positive : ''}
${$type === 'loading' ? theme.colors.primary : ''}
${$type === 'info' ? theme.colors.teal : ''}
${$type === 'error' ? theme.colors.negative : ''}
${$type === 'warning' ? theme.colors.orange : ''}
${$type === undefined ? theme.colors.positive : ''}
`};

display: flex;
border-radius: 4px;
border: 2px solid var(--color);
border: 1.5px solid var(--color);
border-left-width: 0px;
background: linear-gradient(
to right,
Expand Down
116 changes: 69 additions & 47 deletions packages/components/src/Button/Button.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,40 @@ import { Activity } from '../icons'
export const Template = (args) => <Button {...args}>Click here</Button>

export const Sizes = () => (
<Stack>
<Button type="primary" size="large">
Large
</Button>
<Button type="primary" size="medium">
Default
</Button>
<Button type="primary" size="small">
Small
</Button>
<Button type="secondary" size="large">
Large
</Button>
<Button type="secondary" size="medium">
Default
</Button>
<Button type="secondary" size="small">
Small
</Button>
<Button type="tertiary" size="large">
Large
</Button>
<Button type="tertiary" size="medium">
Default
</Button>
<Button type="tertiary" size="small">
Small
</Button>
<Stack direction="column" alignItems="left">
<Stack>
<Button type="primary" size="large">
Large
</Button>
<Button type="primary" size="medium">
Default
</Button>
<Button type="primary" size="small">
Small
</Button>
</Stack>
<Stack>
<Button type="secondary" size="large">
Large
</Button>
<Button type="secondary" size="medium">
Default
</Button>
<Button type="secondary" size="small">
Small
</Button>
</Stack>
<Stack>
<Button type="tertiary" size="large">
Large
</Button>
<Button type="tertiary" size="medium">
Default
</Button>
<Button type="tertiary" size="small">
Small
</Button>
</Stack>
</Stack>
)

Expand All @@ -60,25 +66,41 @@ export const WithIcon = () => (
)

export const Icons = () => (
<Stack>
<Button type="icon" size="large" aria-label="View performance data">
<Icon name="Target" size="large" />
</Button>
<Button type="icon" size="medium" aria-label="View performance data">
<Icon name="Target" size="medium" />
</Button>
<Button type="icon" size="small" aria-label="View performance data">
<Icon name="Target" size="medium" />
</Button>
<Button type="iconPrimary" size="large" aria-label="View performance data">
<Icon name="Target" size="large" />
</Button>
<Button type="iconPrimary" size="medium" aria-label="View performance data">
<Icon name="Target" size="medium" />
</Button>
<Button type="iconPrimary" size="small" aria-label="View performance data">
<Icon name="Target" size="medium" />
</Button>
<Stack direction="column" alignItems="left">
<Stack>
<Button
type="iconPrimary"
size="large"
aria-label="View performance data"
>
<Icon name="Target" size="large" />
</Button>
<Button
type="iconPrimary"
size="medium"
aria-label="View performance data"
>
<Icon name="Target" size="medium" />
</Button>
<Button
type="iconPrimary"
size="small"
aria-label="View performance data"
>
<Icon name="Target" size="medium" />
</Button>
</Stack>
<Stack>
<Button type="icon" size="large" aria-label="View performance data">
<Icon name="Target" size="large" />
</Button>
<Button type="icon" size="medium" aria-label="View performance data">
<Icon name="Target" size="medium" />
</Button>
<Button type="icon" size="small" aria-label="View performance data">
<Icon name="Target" size="medium" />
</Button>
</Stack>
</Stack>
)

Expand Down
58 changes: 40 additions & 18 deletions packages/components/src/Button/Button.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ export const primary = ({ loading }: { loading?: boolean }) => css`
color: ${({ theme }) => theme.colors.white};
background: ${({ theme }) => theme.colors.primary};

svg {
color: ${({ theme }) => theme.colors.white};
}

&:hover {
background: ${({ theme }) => theme.colors.primaryDark};
}
Expand All @@ -66,52 +70,62 @@ export const primary = ({ loading }: { loading?: boolean }) => css`
`

export const secondary = css`
border: 2px solid ${({ theme }) => theme.colors.primary};
color: ${({ theme }) => theme.colors.primary};
border: 1.5px solid ${({ theme }) => theme.colors.primary};
color: ${({ theme }) => theme.colors.copy};

svg {
color: ${({ theme }) => theme.colors.primary};
}

&:hover {
border: 1.5px solid ${({ theme }) => theme.colors.primaryDark};
background: ${({ theme }) => theme.colors.grey100};
border: 2px solid ${({ theme }) => theme.colors.primaryDark};
color: ${({ theme }) => theme.colors.primaryDark};
}
&:active {
background: ${({ theme }) => theme.colors.grey200};
color: ${({ theme }) => theme.colors.primaryDarker};
}

&:focus-visible {
border: 2px solid ${({ theme }) => theme.colors.grey600};
border: 1.5px solid ${({ theme }) => theme.colors.grey600};
background: ${({ theme }) => theme.colors.yellow};
color: ${({ theme }) => theme.colors.grey600};
}
`

export const secondaryNegative = css`
border: 2px solid ${({ theme }) => theme.colors.negative};
color: ${({ theme }) => theme.colors.negative};
border: 1.5px solid ${({ theme }) => theme.colors.negative};
color: ${({ theme }) => theme.colors.copy};

svg {
color: ${({ theme }) => theme.colors.negative};
}

&:hover {
background: ${({ theme }) => theme.colors.grey100};
border: 2px solid ${({ theme }) => theme.colors.negativeDark};
color: ${({ theme }) => theme.colors.negativeDark};
border: 1.5px solid ${({ theme }) => theme.colors.negativeDark};
}

&:active {
background: ${({ theme }) => theme.colors.grey200};
color: ${({ theme }) => theme.colors.negativeDarker};
}

&:focus-visible {
border: 2px solid ${({ theme }) => theme.colors.negativeDarker};
border: 1.5px solid ${({ theme }) => theme.colors.negativeDarker};
background: ${({ theme }) => theme.colors.yellow};
color: ${({ theme }) => theme.colors.negativeDarker};
}
`

export const tertiary = css`
color: ${({ theme }) => theme.colors.primary};
color: ${({ theme }) => theme.colors.copy};

svg {
color: ${({ theme }) => theme.colors.primary};
}

&:hover {
background: ${({ theme }) => theme.colors.grey100};
color: ${({ theme }) => theme.colors.primaryDark};
}

&:active {
background: ${({ theme }) => theme.colors.grey200};
}
Expand All @@ -121,6 +135,10 @@ export const positive = css`
background: ${({ theme }) => theme.colors.positive};
color: ${({ theme }) => theme.colors.white};

svg {
color: ${({ theme }) => theme.colors.positive};
}

&:hover {
background: ${({ theme }) => theme.colors.positiveDark};
}
Expand All @@ -133,6 +151,10 @@ export const negative = css`
background: ${({ theme }) => theme.colors.negative};
color: ${({ theme }) => theme.colors.white};

svg {
color: ${({ theme }) => theme.colors.white};
}

&:hover {
background: ${({ theme }) => theme.colors.negativeDark};
}
Expand All @@ -146,7 +168,7 @@ export const icon = css`
border-radius: 100%;
aspect-ratio: 1 / 1;

&:hover:not(:focus-visible) {
&:hover {
background: ${({ theme }) => theme.colors.grey100};
}
&:active {
Expand All @@ -164,7 +186,7 @@ export const iconPrimary = css`
border-radius: 100%;
aspect-ratio: 1 / 1;

&:hover:not(:focus-visible) {
&:hover {
background: ${({ theme }) => theme.colors.primaryDark};
}
&:active {
Expand Down Expand Up @@ -209,7 +231,7 @@ export const medium = css`
`

export const large = css`
${({ theme }) => theme.fonts.bold18};
${({ theme }) => theme.fonts.reg18};
height: 54px;
padding: 0 16px;

Expand Down
8 changes: 4 additions & 4 deletions packages/components/src/Pill/Pill.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ const fontMap: Record<IPillSize, IFont> = {

const StyledPill = styled.span<{ size: IPillSize; type: IPillType }>`
--background-color: ${({ type, theme }) => `
${type === 'active' ? theme.colors.greenLighter : ''}
${type === 'inactive' ? theme.colors.redLighter : ''}
${type === 'pending' ? theme.colors.orangeLighter : ''}
${type === 'default' ? theme.colors.primaryLighter : ''}
${type === 'active' ? theme.colors.greenLight : ''}
${type === 'inactive' ? theme.colors.redLight : ''}
${type === 'pending' ? theme.colors.orangeLight : ''}
${type === 'default' ? theme.colors.primaryLight : ''}
`};

--color: ${({ type, theme }) => `
Expand Down
Loading
Loading