Skip to content
This repository was archived by the owner on Nov 26, 2024. It is now read-only.

Commit 7c0223c

Browse files
refactor: updating theme colors to csf3 and mdx updated
1 parent 4249b32 commit 7c0223c

File tree

2 files changed

+35
-52
lines changed

2 files changed

+35
-52
lines changed

docs/ThemeColors.mdx

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,26 @@
1-
import { Meta, Canvas, Story } from '@storybook/addon-docs';
1+
import { Meta, Canvas } from '@storybook/addon-docs/blocks';
2+
import * as ThemeColorStories from './ThemeColors.stories';
23

3-
<Meta title="Design Tokens/Theme Colors" />
4+
<Meta title="Design Tokens/Theme Colors" of={ThemeColorStories.default} />
45

5-
# Theme Colors (second tier)
6+
# Theme Colors (Second Tier)
67

7-
Theme colors take the first tier [**Brand Colors**](/docs/colors-brandcolors--default-story) and start applying them to high-level applications within the UI. They are considered second tier tokens and can be used in the code directly. Theme colors should be used liberally throughout the codebase and create theme compatibility in your components.
8+
Theme colors are derived from the first-tier [**brand colors**](/docs/colors-brandcolors--docs). They are applied to high-level applications within the UI and are considered second-tier tokens. These colors can be used directly in the code and should be used liberally throughout the codebase to ensure theme compatibility and accessibility in your components.
89

910
- [Light Theme Colors](#light-theme-colors)
1011
- [Dark Theme Colors](#dark-theme-colors)
1112

1213
## Light Theme Colors
1314

14-
Light theme colors to be used in the styles for MetaMask UI.
15+
The light theme colors are designed to be used in the styles for MetaMask UI when the light theme is active
1516

16-
<Canvas>
17-
<Story id="colors-themecolors--light-theme-colors" />
18-
</Canvas>
17+
<Canvas of={ThemeColorStories.LightThemeColors} />
1918

2019
## Dark Theme Colors
2120

22-
Dark theme colors for MetaMask UI. They have the same name as Light Theme Colors but different values. If you are using the Light Theme Colors for their intended purpose your UI will be dark theme compatible.
21+
The dark theme colors are designed for MetaMask UI when the dark theme is active. They have the same names as the light theme colors but different values. If you are using the light theme colors for their intended purpose, your UI will automatically be compatible with the dark theme.
2322

24-
<Canvas>
25-
<Story id="colors-themecolors--dark-theme-colors" />
26-
</Canvas>
23+
<Canvas of={ThemeColorStories.DarkThemeColors} />
2724

2825
## References
2926

docs/ThemeColors.stories.tsx

Lines changed: 26 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
import React from 'react';
2-
import { StoryFn, Meta } from '@storybook/react';
3-
2+
import tokens from '../src/figma/tokens.json';
43
import { ColorSwatchGroup } from './components';
54
import README from './ThemeColors.mdx';
65

7-
import tokens from '../src/figma/tokens.json';
8-
96
export default {
107
title: 'Colors/ThemeColors',
118
component: ColorSwatchGroup,
@@ -14,53 +11,42 @@ export default {
1411
page: README,
1512
},
1613
},
17-
} as Meta<typeof ColorSwatchGroup>;
18-
19-
const Template: StoryFn<typeof ColorSwatchGroup> = (args) => {
20-
return (
21-
<>
22-
<ColorSwatchGroup {...args} />
23-
</>
24-
);
25-
};
26-
27-
export const LightThemeColors = Template.bind({});
28-
29-
LightThemeColors.args = {
30-
swatchData: tokens.light.colors,
31-
borderColor: tokens.light.colors.border.muted.value,
32-
textBackgroundColor: tokens.light.colors.background.default.value,
33-
textColor: tokens.light.colors.text.default.value,
3414
};
3515

36-
export const DarkThemeColors = Template.bind({});
37-
38-
DarkThemeColors.args = {
39-
swatchData: tokens.dark.colors,
40-
borderColor: tokens.dark.colors.border.muted.value,
41-
textBackgroundColor: tokens.dark.colors.background.default.value,
42-
textColor: tokens.dark.colors.text.default.value,
43-
};
44-
45-
DarkThemeColors.parameters = {
46-
backgrounds: {
47-
default: 'dark',
48-
values: [
49-
{ name: 'dark', value: tokens.dark.colors.background.default.value },
50-
],
16+
export const LightThemeColors = {
17+
render: () => <ColorSwatchGroup {...LightThemeColors.args} />,
18+
args: {
19+
swatchData: tokens.light.colors,
20+
borderColor: tokens.light.colors.border.muted.value,
21+
textBackgroundColor: tokens.light.colors.background.default.value,
22+
textColor: tokens.light.colors.text.default.value,
5123
},
5224
};
5325

54-
DarkThemeColors.decorators = [
55-
(Story) => (
26+
export const DarkThemeColors = {
27+
render: () => (
5628
<div
5729
style={{
5830
backgroundColor: tokens.dark.colors.background.default.value,
5931
margin: '-1rem',
6032
padding: '1rem',
6133
}}
6234
>
63-
<Story />
35+
<ColorSwatchGroup {...DarkThemeColors.args} />
6436
</div>
6537
),
66-
];
38+
args: {
39+
swatchData: tokens.dark.colors,
40+
borderColor: tokens.dark.colors.border.muted.value,
41+
textBackgroundColor: tokens.dark.colors.background.default.value,
42+
textColor: tokens.dark.colors.text.default.value,
43+
},
44+
parameters: {
45+
backgrounds: {
46+
default: 'dark',
47+
values: [
48+
{ name: 'dark', value: tokens.dark.colors.background.default.value },
49+
],
50+
},
51+
},
52+
};

0 commit comments

Comments
 (0)