Skip to content

Commit

Permalink
feat(tokens): add in additional table tokens (#2035)
Browse files Browse the repository at this point in the history
- eds-color-blue-025
- eds-theme-color-background-tableRow-stripe-1
- eds-theme-color-background-tableRow-stripe-2
- eds-theme-color-background-tableRow-selected
- add in color token stories
  • Loading branch information
booc0mtaco authored Aug 15, 2024
1 parent df84c87 commit a698a5b
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 16 deletions.
16 changes: 0 additions & 16 deletions .storybook/components/DesignTokens/Tier2/Colors.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,6 @@ export const TextUtility: StoryObj = {
),
};

export const IconUtility: StoryObj = {
render: () => (
<div>
<Section title="Icon Colors (utility)">
<ColorList
listItems={getListItems({
filterTerm: 'eds-theme-color-icon-utility',
figmaTokenHeader: 'icon',
tailwindClassHeader: 'text-icon-utility',
})}
/>
</Section>
</div>
),
};

export const BackgroundUtility: StoryObj = {
render: () => (
<div>
Expand Down
72 changes: 72 additions & 0 deletions .storybook/components/DesignTokens/Tier3/Colors.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import type { StoryObj } from '@storybook/react';
import React from 'react';
import filterTokens from '../../../util/filterTokens';
import { ColorList } from '../../ColorList/ColorList';
import Section from '../../Section';

export default {
title: 'Design Tokens/Tier 3: Component/Colors',
parameters: {
axe: {
// For documentation purposes only
skip: true,
},
},
};

const camelCaseWarning =
'NOTE: table tokens have a camelCase suffix for the emphasis (e.g., tableRow)';

const getListItems = ({
filterTerm,
figmaTokenHeader,
tailwindClassHeader,
}: {
filterTerm: string;
figmaTokenHeader: string;
tailwindClassHeader: string;
}) =>
filterTokens(filterTerm).map(({ name, value }) => {
const specifier = name.slice(
name.indexOf(filterTerm) + filterTerm.length + 1,
);
return {
name,
value,
figmaToken: figmaTokenHeader + '/' + specifier,
tailwindClass: tailwindClassHeader + '-' + specifier,
};
});

export const IconUtility: StoryObj = {
render: () => (
<div>
<Section title="Icon Colors (utility)">
<ColorList
listItems={getListItems({
filterTerm: 'eds-theme-color-icon-utility',
figmaTokenHeader: 'icon',
tailwindClassHeader: 'text-icon-utility',
})}
/>
</Section>
</div>
),
};

// TODO: handle name formatting for tableRow tokens in figma and tailwind
export const BackgroundTable: StoryObj = {
render: () => (
<div>
<Section description={camelCaseWarning} title="Background Colors (Table)">
<ColorList
listItems={getListItems({
filterTerm: 'eds-theme-color-background-table',
figmaTokenHeader: 'background',
tailwindClassHeader: 'bg-table',
})}
/>
</Section>
</div>
),
};
4 changes: 4 additions & 0 deletions .storybook/data/tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@
"eds-theme-color-background-brand-purple": "#C580E7",
"eds-theme-color-background-brand-purple-low-emphasis": "#FBF5FD",
"eds-theme-color-background-brand-pink": "#DB458D",
"eds-theme-color-background-table-row-stripe-1": "#F5FAFF",
"eds-theme-color-background-table-row-stripe-2": "rgb(var(--eds-color-white) / 1)",
"eds-theme-color-background-table-row-selected": "#CEE6FF",
"eds-theme-color-background-utility-base-1": "rgb(var(--eds-color-white) / 1)",
"eds-theme-color-background-utility-base-2": "#FDF9F8",
"eds-theme-color-background-utility-container": "rgb(var(--eds-color-white) / 1)",
Expand Down Expand Up @@ -722,6 +725,7 @@
"eds-color-blue-850": "#0F2163",
"eds-color-blue-900": "#0A164C",
"eds-color-blue-950": "#060E30",
"eds-color-blue-025": "#F5FAFF",
"eds-color-blue-050": "#EAF4FF",
"eds-color-pink-350": "#E67EB0",
"eds-color-pink-450": "#DB458D",
Expand Down
1 change: 1 addition & 0 deletions src/design-tokens/primitives.json
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@
"950": { "value": "#05120C", "group": "color" }
},
"blue": {
"025": { "value": "#F5FAFF", "group": "color" },
"050": { "value": "#EAF4FF", "group": "color" },
"100": { "value": "#CEE6FF", "group": "color" },
"150": { "value": "#B5DAFF", "group": "color" },
Expand Down
14 changes: 14 additions & 0 deletions src/design-tokens/themes.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,20 @@
"value": "{eds.color.pink.450}"
}
},
"tableRow": {
"stripe": {
"1": {
"value": "{eds.color.blue.025}",
"group": "color"
},
"2": {
"value": "{eds.theme.color.background.utility.base.1}"
}
},
"selected": {
"value": "{eds.color.blue.100}"
}
},
"utility": {
"base": {
"1": {
Expand Down
4 changes: 4 additions & 0 deletions src/tokens-dist/css/variables.css
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
--eds-color-pink-450: #DB458D;
--eds-color-pink-350: #E67EB0;
--eds-color-blue-050: #EAF4FF;
--eds-color-blue-025: #F5FAFF;
--eds-color-blue-950: #060E30;
--eds-color-blue-900: #0A164C;
--eds-color-blue-850: #0F2163;
Expand Down Expand Up @@ -754,6 +755,9 @@
--eds-theme-color-background-utility-container-active: var(--eds-color-neutral-100);
--eds-theme-color-background-utility-container-hover: var(--eds-color-neutral-050);
--eds-theme-color-background-utility-base-2: var(--eds-color-neutral-025);
--eds-theme-color-background-table-row-selected: var(--eds-color-blue-100);
--eds-theme-color-background-table-row-stripe-2: var(--eds-theme-color-background-utility-base-1);
--eds-theme-color-background-table-row-stripe-1: var(--eds-color-blue-025);
--eds-theme-color-background-brand-pink: var(--eds-color-pink-450);
--eds-theme-color-background-brand-purple-low-emphasis: var(--eds-color-purple-050);
--eds-theme-color-background-brand-purple: var(--eds-color-purple-350);
Expand Down
8 changes: 8 additions & 0 deletions src/tokens-dist/json/variables-nested.json
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,13 @@
},
"pink": "#DB458D"
},
"tableRow": {
"stripe": {
"1": "#F5FAFF",
"2": "rgb(var(--eds-color-white) / 1)"
},
"selected": "#CEE6FF"
},
"utility": {
"base": {
"1": "rgb(var(--eds-color-white) / 1)",
Expand Down Expand Up @@ -1345,6 +1352,7 @@
"850": "#0F2163",
"900": "#0A164C",
"950": "#060E30",
"025": "#F5FAFF",
"050": "#EAF4FF"
},
"pink": {
Expand Down
5 changes: 5 additions & 0 deletions src/tokens-dist/ts/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ export const EdsThemeColorBackgroundBrandBlueLowEmphasis = '#EAF4FF';
export const EdsThemeColorBackgroundBrandPurple = '#C580E7';
export const EdsThemeColorBackgroundBrandPurpleLowEmphasis = '#FBF5FD';
export const EdsThemeColorBackgroundBrandPink = '#DB458D';
export const EdsThemeColorBackgroundTableRowStripe1 = '#F5FAFF';
export const EdsThemeColorBackgroundTableRowStripe2 =
'rgb(var(--eds-color-white) / 1)';
export const EdsThemeColorBackgroundTableRowSelected = '#CEE6FF';
export const EdsThemeColorBackgroundUtilityBase1 =
'rgb(var(--eds-color-white) / 1)';
export const EdsThemeColorBackgroundUtilityBase2 = '#FDF9F8';
Expand Down Expand Up @@ -591,6 +595,7 @@ export const EdsColorBlue800 = '#152D76';
export const EdsColorBlue850 = '#0F2163';
export const EdsColorBlue900 = '#0A164C';
export const EdsColorBlue950 = '#060E30';
export const EdsColorBlue025 = '#F5FAFF';
export const EdsColorBlue050 = '#EAF4FF';
export const EdsColorPink350 = '#E67EB0';
export const EdsColorPink450 = '#DB458D';
Expand Down

0 comments on commit a698a5b

Please sign in to comment.