Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Commit

Permalink
Add violet cache story
Browse files Browse the repository at this point in the history
  • Loading branch information
juliewongbandue committed Sep 11, 2023
1 parent a68bde6 commit f17441b
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
43 changes: 43 additions & 0 deletions src/color/colors-brand.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Story } from '../storybook';
import { Header as H } from '../typography';

import { ColorPalette, ColorStory } from './storyComponents';
import { parseToRgb } from 'polished';

import {
fuschia,
Expand Down Expand Up @@ -90,6 +91,48 @@ export function Taupe() {
}
Taupe.storyName = 'taupe';

function ColorSwatch({ color, title, ...props }) {
const { red, green, blue } = parseToRgb(color);
const rbgString = `rgb(${red}, ${green}, ${blue})`;
return (
<div
style={{
display: 'inline-block',
overflow: 'hidden',
paddingRight: '1rem',
}}
{...props}
>
<ColorSwatchStyled color={color} />
<Header size="5">{title}</Header>
<Header size="5">{color}</Header>
<Header size="5">{rbgString}</Header>
</div>
);
}

const ColorSwatchStyled = styled.div`
width: calc(3rem + 1.25vw);
height: calc(3rem + 1.25vw);
background: ${({ color }) => color};
margin-right: 0.125rem;
border-radius: 0.25rem;
`;
export function Violet() {
const violetCache = [
0, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000,
];
return (
<>
<Header>Violet</Header>
{violetCache.map((grade, i) => (
<ColorSwatch key={i} color={violet(grade)} title={grade} />
))}
</>
);
}
Violet.storyName = 'violet';

const Header = styled(H)`
margin: 0;
`;
2 changes: 1 addition & 1 deletion src/components/Button/Button.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ function buttonUpsellNew({ format }) {
return css`
border: 1px solid transparent;
background: ${core.color.upsell.New};
color: #fff;
color: ${violet(0)};
&:active {
background: ${violet(600)};
Expand Down

0 comments on commit f17441b

Please sign in to comment.