-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tokens): add in additional table tokens (#2035)
- 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
1 parent
df84c87
commit a698a5b
Showing
8 changed files
with
108 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
.storybook/components/DesignTokens/Tier3/Colors.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters