Skip to content

Commit

Permalink
docs: split t2 colors stories and remove t2 stories aggregator
Browse files Browse the repository at this point in the history
  • Loading branch information
Jin Lee committed Aug 7, 2023
1 parent 41cf335 commit 78229e8
Show file tree
Hide file tree
Showing 8 changed files with 219 additions and 315 deletions.
33 changes: 0 additions & 33 deletions .storybook/components/DesignTokens/Tier2/Borders.jsx

This file was deleted.

42 changes: 42 additions & 0 deletions .storybook/components/DesignTokens/Tier2/Borders.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import type { StoryObj } from '@storybook/react';
import React from 'react';
import { Grid, Section } from '../../../../src';
import filterTokens from '../../../util/filterTokens';
import { TokenSpecimen } from '../../TokenSpecimen/TokenSpecimen';

export default {
title: 'Design Tokens/Tier 2: Usage/Borders',
parameters: {
axe: {
// For documentation purposes only
skip: true,
},
},
};

export const Borders: StoryObj = {
render: () => (
<div>
<Section title="Border Width">
<Grid>
{filterTokens(`eds-theme-border-width`).map(function (listItem) {
return (
<Grid.Item key={listItem.name}>
<TokenSpecimen
inlineStyles={{
backgroundColor: 'transparent',
borderWidth: `var(${listItem.name})`,
borderStyle: 'solid',
borderColor: 'black',
}}
name={listItem.name}
value={listItem.value}
/>
</Grid.Item>
);
})}
</Grid>
</Section>
</div>
),
};
199 changes: 0 additions & 199 deletions .storybook/components/DesignTokens/Tier2/Colors.jsx

This file was deleted.

100 changes: 100 additions & 0 deletions .storybook/components/DesignTokens/Tier2/Colors.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import type { StoryObj } from '@storybook/react';
import React from 'react';
import { Section } from '../../../../src';
import filterTokens from '../../../util/filterTokens';
import { ColorList } from '../../ColorList/ColorList';

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

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 Text: StoryObj = {
render: () => (
<div className="text-neutral-default">
<Section title="Text Colors">
<ColorList
listItems={getListItems({
filterTerm: 'eds-theme-color-text',
figmaTokenHeader: 'text',
tailwindClassHeader: 'text',
})}
/>
</Section>
</div>
),
};

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

export const Background: StoryObj = {
render: () => (
<div>
<Section title="Background Colors">
<ColorList
listItems={getListItems({
filterTerm: 'eds-theme-color-background',
figmaTokenHeader: 'background',
tailwindClassHeader: 'bg',
})}
/>
</Section>
</div>
),
};

export const Border: StoryObj = {
render: () => (
<div>
<Section title="Border Colors">
<ColorList
listItems={getListItems({
filterTerm: 'eds-theme-color-border',
figmaTokenHeader: 'border',
tailwindClassHeader: 'border',
})}
/>
</Section>
</div>
),
};
Loading

0 comments on commit 78229e8

Please sign in to comment.