generated from MetaMask/metamask-module-template
-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updating documentation #593
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
b2425ce
refactor: updating deprecated storybook components
georgewrmarshall eb9039b
Merge branch 'refactor/updating-deprecated-sb-components' into fix/sb…
georgewrmarshall cbfbc85
Upgrading storybook from 7.5 to 7.6.10
georgewrmarshall 6e74c59
fix:updating order of pages
georgewrmarshall 28944fe
refactor: updating deprecated components and updating docs
georgewrmarshall 162915c
docs: updating readme spelling mistake and latest node version and Fi…
georgewrmarshall 4249b32
docs: updates to documentation for intro color and brand color
georgewrmarshall 7c0223c
refactor: updating theme colors to csf3 and mdx updated
georgewrmarshall ed53249
docs: updating links to theme and brand colors to go to docs page
georgewrmarshall ec3cd2e
fix: fixing link to documentation
georgewrmarshall a745a13
docs: updating brand color docs
georgewrmarshall c2c8e48
docs: updating theme docs and creating contents and moving best pract…
georgewrmarshall 8fa3991
fix: removing contents from color intro page as its short and not needed
georgewrmarshall c95bad4
fix: removing meta tags
georgewrmarshall 6305605
fix: fixing links after page title change
georgewrmarshall 31bec54
fix: merge conflict
georgewrmarshall aa83d99
fix: broken anchor link
georgewrmarshall File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,10 +103,10 @@ Follow these steps to below to get the library up and running locally. | |
|
||
### Setup | ||
|
||
- Install [Node.js](https://nodejs.org) version 12 | ||
- Install [Node.js](https://nodejs.org) version 16 | ||
- If you are using [nvm](https://github.com/creationix/nvm#installation) (recommended) running `nvm use` will automatically choose the right node version for you. | ||
- Install [Yarn v1](https://yarnpkg.com/en/docs/install) | ||
- Run `yarn setup` to install dependencies and run any requried post-install scripts | ||
- Run `yarn setup` to install dependencies and run any required post-install scripts | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixing spelling mistake |
||
- **Warning:** Do not use the `yarn` / `yarn install` command directly. Use `yarn setup` instead. The normal install command will skip required post-install scripts, leaving your development environment in an invalid state. | ||
|
||
### Documentation | ||
|
@@ -117,9 +117,9 @@ We use storybook for documentation. To get storybook up and running use: | |
yarn storybook | ||
``` | ||
|
||
### Figma Tokens | ||
### Tokens Studio for Figma (formerly known as Figma Tokens) | ||
|
||
The primary data for the generation of tokens is based on the json generated from a figma plugin called [Figma Tokens](https://github.com/six7/figma-tokens). This keeps our code in sync with our figma libraries. Currently the token formats are manually generated we are hoping to automate this process in future. | ||
The primary data for the generation of tokens is based on the json generated from a figma plugin called [Tokens Studio for Figma (formerly known as Figma Tokens)](https://github.com/six7/figma-tokens). This keeps our code in sync with our figma libraries. Currently the token formats are manually generated we are hoping to automate this process in future. | ||
|
||
### Testing and Linting | ||
|
||
|
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 |
---|---|---|
@@ -1,17 +1,68 @@ | ||
import { Meta, Canvas, Story } from '@storybook/addon-docs'; | ||
import LinkTo from '@storybook/addon-links/react'; | ||
import { Canvas } from '@storybook/blocks'; | ||
import * as BrandColorStories from './BrandColors.stories'; | ||
|
||
<Meta title="Design Tokens/Brand Colors" /> | ||
# Brand colors (first tier) | ||
|
||
# Brand Colors (first tier) | ||
Brand colors form the foundation of our color system. They use literal color names (like red, green, etc.) and a numeric scale (where 000 is light and 900 is dark) by default. These colors are essential to maintaining visual consistency across our products and are primarily used as a reference for the [theme colors](/docs/colors-theme-colors--docs). | ||
|
||
Brand specific colors used in the first tier of design token abstraction. They **should not** be used in the code directly but referenced by [**Theme Colors**](/docs/colors-themecolors--light-theme-colors) used in second tier tokens. Most brand color progressions were generated using [0to255](https://0to255.com/037dd6) | ||
While these colors are fundamental to our design system, they **should not** be used directly in most cases. Instead, they should be referenced via [theme colors](/docs/colors-theme-colors--docs), which form the second tier of our design tokens. | ||
|
||
<Canvas> | ||
<Story id="colors-brandcolors--default-story" /> | ||
</Canvas> | ||
However, in rare cases where a color needs to remain constant across themes (e.g., white always being white, regardless of light or dark mode), the corresponding brand color can be used. Always ensure there isn't an existing theme token that could be used instead. | ||
|
||
_The majority of our brand color progressions were generated using the [0to255](https://0to255.com/037dd6) tool, which helps ensure smooth and consistent color transitions._ | ||
|
||
- [**Brand colors**](#brand-colors) | ||
- [**Best practices**](#best-practices) | ||
- [**References**](#references) | ||
|
||
## Brand colors | ||
|
||
<Canvas of={BrandColorStories.DefaultStory} /> | ||
|
||
## Best Practices | ||
|
||
### ✅ **DO**: Use brand colors when the color should remain the same across all themes | ||
|
||
```jsx | ||
fill: brandColors.white.white000; | ||
fill: var(--brand-colors-white-white000); | ||
``` | ||
|
||
### ❌ **DON'T**: Use brand colors without checking for an existing theme token first | ||
|
||
```jsx | ||
background-color: brandColors.blue.blue500; // Brand color instead of theme.color.primary.default | ||
background-color: var(--brand-colors-blue-blue500); // Brand color instead of var(--color-primary-default) | ||
``` | ||
|
||
### ✅ **DO**: Store non-token colors in a global file | ||
|
||
If you need to use colors that are not included in the design tokens, store these colors in a global file in your project. This makes it easier to keep track of these colors and update them as needed. Always consider this as a last resort, and strive to use design tokens wherever possible. | ||
|
||
```jsx | ||
// colors.js | ||
export const customColors = { | ||
myCustomColor: '#abc123', | ||
}; | ||
|
||
// colors.css | ||
--custom-colors-my-custom-color: #abc123; | ||
|
||
// component.js | ||
import { customColors } from './colors.js'; | ||
|
||
background-color: customColors.myCustomColor; | ||
background-color: var(--custom-colors-my-custom-color); | ||
``` | ||
|
||
### ❌ **DON'T**: Use non-token colors directly in your components | ||
|
||
```jsx | ||
// Avoid | ||
background-color: #abc123; // Custom color not in design tokens or global file | ||
``` | ||
|
||
## References | ||
|
||
- [Tool used to generate colors](http://www.0to255.com/037DD6) | ||
- [Figma Brand Colors Library](https://www.figma.com/file/cBAUPFMnbv6tHR1J8KvBI2/Brand-Colors?node-id=0%3A1)(internal use only) | ||
- [0to255](http://www.0to255.com/037DD6): The tool we used to generate our color progressions. | ||
- [Figma Brand Colors Library](https://www.figma.com/file/cBAUPFMnbv6tHR1J8KvBI2/Brand-Colors?node-id=0%3A1): Our internal Figma library for brand colors. Please note that this is for internal use only. |
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 |
---|---|---|
@@ -1,27 +1,24 @@ | ||
import { ComponentStory, ComponentMeta } from '@storybook/react'; | ||
import React from 'react'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import tokens from '../src/figma/tokens.json'; | ||
|
||
import { ColorSwatchGroup } from './components'; | ||
|
||
import README from './BrandColors.mdx'; | ||
|
||
export default { | ||
title: 'Colors/BrandColors', | ||
const meta: Meta<typeof ColorSwatchGroup> = { | ||
title: 'Colors/Brand Colors', | ||
component: ColorSwatchGroup, | ||
parameters: { | ||
docs: { | ||
page: README, | ||
}, | ||
}, | ||
} as ComponentMeta<typeof ColorSwatchGroup>; | ||
}; | ||
|
||
const Template: ComponentStory<typeof ColorSwatchGroup> = (args) => ( | ||
<ColorSwatchGroup {...args} /> | ||
); | ||
export default meta; | ||
|
||
export const DefaultStory = Template.bind({}); | ||
type Story = StoryObj<typeof ColorSwatchGroup>; | ||
|
||
DefaultStory.args = { | ||
swatchData: tokens.global.brandColors, | ||
export const DefaultStory: Story = { | ||
render: () => <ColorSwatchGroup swatchData={tokens.global.brandColors} />, | ||
name: 'Default', | ||
}; | ||
|
||
DefaultStory.storyName = 'Default'; |
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updating node version to 16 as stated in the package.json
design-tokens/package.json
Line 88 in 0910f70
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense - nvmrc is also already at 16