Skip to content

Commit 1bca6a4

Browse files
Merge branch 'dev' of github.com:bhargavkakadiya/ethereum-org-website into multi-select-user-persona
2 parents b922a9e + e4e7cfb commit 1bca6a4

File tree

616 files changed

+10580
-7349
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

616 files changed

+10580
-7349
lines changed

.all-contributorsrc

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11490,7 +11490,8 @@
1149011490
"avatar_url": "https://avatars.githubusercontent.com/u/72754835?v=4",
1149111491
"profile": "https://github.com/0xemrekaya",
1149211492
"contributions": [
11493-
"tutorial"
11493+
"tutorial",
11494+
"doc"
1149411495
]
1149511496
},
1149611497
{
@@ -11736,7 +11737,8 @@
1173611737
"avatar_url": "https://avatars.githubusercontent.com/u/61613931?v=4",
1173711738
"profile": "https://dharmik79.github.io/portfolio.github.io/",
1173811739
"contributions": [
11739-
"bug"
11740+
"bug",
11741+
"code"
1174011742
]
1174111743
},
1174211744
{
@@ -11959,6 +11961,51 @@
1195911961
"contributions": [
1196011962
"maintenance"
1196111963
]
11964+
},
11965+
{
11966+
"login": "liuye20240304",
11967+
"name": "liuye20240304",
11968+
"avatar_url": "https://avatars.githubusercontent.com/u/162123251?v=4",
11969+
"profile": "https://github.com/liuye20240304",
11970+
"contributions": [
11971+
"doc"
11972+
]
11973+
},
11974+
{
11975+
"login": "zk-Lumi",
11976+
"name": "Daniel Lumi",
11977+
"avatar_url": "https://avatars.githubusercontent.com/u/149794418?v=4",
11978+
"profile": "https://zksync.io",
11979+
"contributions": [
11980+
"maintenance"
11981+
]
11982+
},
11983+
{
11984+
"login": "ZakGriffith",
11985+
"name": "Zak G",
11986+
"avatar_url": "https://avatars.githubusercontent.com/u/12072395?v=4",
11987+
"profile": "https://github.com/ZakGriffith",
11988+
"contributions": [
11989+
"tutorial"
11990+
]
11991+
},
11992+
{
11993+
"login": "barskhianfannie",
11994+
"name": "Fannie Barskhian",
11995+
"avatar_url": "https://avatars.githubusercontent.com/u/42990794?v=4",
11996+
"profile": "http://fanniebarskhian.com",
11997+
"contributions": [
11998+
"maintenance"
11999+
]
12000+
},
12001+
{
12002+
"login": "ksdumont",
12003+
"name": "Keith Dumont",
12004+
"avatar_url": "https://avatars.githubusercontent.com/u/51958351?v=4",
12005+
"profile": "https://github.com/ksdumont",
12006+
"contributions": [
12007+
"content"
12008+
]
1196212009
}
1196312010
],
1196412011
"contributorsPerLine": 7,

.github/workflows/stale.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: Close Stale Issues
33
on:
44
schedule:
55
- cron: "0 8 * * *"
6+
workflow_dispatch:
67

78
jobs:
89
stale:
@@ -13,6 +14,9 @@ jobs:
1314
with:
1415
repo-token: ${{ secrets.GITHUB_TOKEN }}
1516
stale-issue-label: "Status: Stale"
16-
stale-issue-message: "This issue is stale because it has been open 45 days with no activity."
17-
days-before-stale: 45
17+
stale-pr-label: "Status: Stale"
18+
stale-issue-message: "This issue is stale because it has been open 30 days with no activity."
19+
stale-pr-message: "This issue is stale because it has been open 30 days with no activity."
20+
days-before-stale: 30
1821
days-before-close: -1
22+
operations-per-run: 250

.storybook/preview.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import "../src/styles/global.css"
99

1010
const extendedTheme = extendBaseTheme(theme)
1111

12-
const chakraBreakpointArray = Object.entries(extendedTheme.breakpoints)
12+
const chakraBreakpointArray = Object.entries(extendedTheme.breakpoints) as [
13+
string,
14+
string
15+
][]
1316

1417
const preview: Preview = {
1518
globals: {
@@ -28,6 +31,11 @@ const preview: Preview = {
2831
backgrounds: {
2932
disable: true,
3033
},
34+
options: {
35+
storySort: {
36+
order: ["Atoms", "Molecules", "Organisms", "Templates", "Pages"],
37+
},
38+
},
3139
chakra: {
3240
theme: extendedTheme,
3341
},
@@ -37,6 +45,9 @@ const preview: Preview = {
3745
viewports: chakraBreakpointArray.reduce((prevVal, currVal) => {
3846
const [token, key] = currVal
3947

48+
// `key` value is in em. Need to convert to px for Chromatic Story mode snapshots
49+
const emToPx = (Number(key.replace("em", "")) * 16).toString() + "px"
50+
4051
// Replace base value
4152
if (token === "base")
4253
return {
@@ -55,7 +66,7 @@ const preview: Preview = {
5566
[token]: {
5667
name: token,
5768
styles: {
58-
width: key,
69+
width: emToPx,
5970
height: "600px",
6071
},
6172
},

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1765,7 +1765,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
17651765
<td align="center" valign="top" width="14.28%"><a href="https://github.com/niuhp"><img src="https://avatars.githubusercontent.com/u/7373524?v=4?s=100" width="100px;" alt="niuhp"/><br /><sub><b>niuhp</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/issues?q=author%3Aniuhp" title="Bug reports">🐛</a></td>
17661766
<td align="center" valign="top" width="14.28%"><a href="https://github.com/xivanc"><img src="https://avatars.githubusercontent.com/u/91614446?v=4?s=100" width="100px;" alt="xivanc"/><br /><sub><b>xivanc</b></sub></a><br /><a href="#tool-xivanc" title="Tools">🔧</a></td>
17671767
<td align="center" valign="top" width="14.28%"><a href="https://github.com/zm-moon"><img src="https://avatars.githubusercontent.com/u/42063103?v=4?s=100" width="100px;" alt="patrick"/><br /><sub><b>patrick</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/issues?q=author%3Azm-moon" title="Bug reports">🐛</a></td>
1768-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/0xemrekaya"><img src="https://avatars.githubusercontent.com/u/72754835?v=4?s=100" width="100px;" alt="Emre"/><br /><sub><b>Emre</b></sub></a><br /><a href="#tutorial-0xemrekaya" title="Tutorials">✅</a></td>
1768+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/0xemrekaya"><img src="https://avatars.githubusercontent.com/u/72754835?v=4?s=100" width="100px;" alt="Emre"/><br /><sub><b>Emre</b></sub></a><br /><a href="#tutorial-0xemrekaya" title="Tutorials">✅</a> <a href="https://github.com/ethereum/ethereum-org-website/commits?author=0xemrekaya" title="Documentation">📖</a></td>
17691769
<td align="center" valign="top" width="14.28%"><a href="http://ryokomy.com"><img src="https://avatars.githubusercontent.com/u/6007453?v=4?s=100" width="100px;" alt="Ryo Komiyama"/><br /><sub><b>Ryo Komiyama</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/issues?q=author%3Aryokomy" title="Bug reports">🐛</a></td>
17701770
</tr>
17711771
<tr>
@@ -1800,7 +1800,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
18001800
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Pedrojok01"><img src="https://avatars.githubusercontent.com/u/77141890?v=4?s=100" width="100px;" alt="Pedrojok01"/><br /><sub><b>Pedrojok01</b></sub></a><br /><a href="#maintenance-Pedrojok01" title="Maintenance">🚧</a></td>
18011801
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Vid201"><img src="https://avatars.githubusercontent.com/u/38610409?v=4?s=100" width="100px;" alt="Vid Kersic"/><br /><sub><b>Vid Kersic</b></sub></a><br /><a href="#tool-Vid201" title="Tools">🔧</a> <a href="https://github.com/ethereum/ethereum-org-website/issues?q=author%3AVid201" title="Bug reports">🐛</a></td>
18021802
<td align="center" valign="top" width="14.28%"><a href="http://www.futantan.com"><img src="https://avatars.githubusercontent.com/u/6268441?v=4?s=100" width="100px;" alt="Tantan Fu"/><br /><sub><b>Tantan Fu</b></sub></a><br /><a href="#maintenance-futantan" title="Maintenance">🚧</a></td>
1803-
<td align="center" valign="top" width="14.28%"><a href="https://dharmik79.github.io/portfolio.github.io/"><img src="https://avatars.githubusercontent.com/u/61613931?v=4?s=100" width="100px;" alt="Dharmik Dholariya"/><br /><sub><b>Dharmik Dholariya</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/issues?q=author%3ADharmik79" title="Bug reports">🐛</a></td>
1803+
<td align="center" valign="top" width="14.28%"><a href="https://dharmik79.github.io/portfolio.github.io/"><img src="https://avatars.githubusercontent.com/u/61613931?v=4?s=100" width="100px;" alt="Dharmik Dholariya"/><br /><sub><b>Dharmik Dholariya</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/issues?q=author%3ADharmik79" title="Bug reports">🐛</a> <a href="https://github.com/ethereum/ethereum-org-website/commits?author=Dharmik79" title="Code">💻</a></td>
18041804
<td align="center" valign="top" width="14.28%"><a href="https://destiner.io"><img src="https://avatars.githubusercontent.com/u/4247901?v=4?s=100" width="100px;" alt="Timur Badretdinov"/><br /><sub><b>Timur Badretdinov</b></sub></a><br /><a href="#tool-Destiner" title="Tools">🔧</a></td>
18051805
<td align="center" valign="top" width="14.28%"><a href="https://blog.finxter.com/"><img src="https://avatars.githubusercontent.com/u/57671493?v=4?s=100" width="100px;" alt="Finxter"/><br /><sub><b>Finxter</b></sub></a><br /><a href="#ideas-finxter" title="Ideas, Planning, & Feedback">🤔</a></td>
18061806
</tr>
@@ -1833,6 +1833,11 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
18331833
</tr>
18341834
<tr>
18351835
<td align="center" valign="top" width="14.28%"><a href="https://olorunsogo-portfolio-sand.vercel.app/"><img src="https://avatars.githubusercontent.com/u/99739569?v=4?s=100" width="100px;" alt="sogobanwo"/><br /><sub><b>sogobanwo</b></sub></a><br /><a href="#maintenance-sogobanwo" title="Maintenance">🚧</a></td>
1836+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/liuye20240304"><img src="https://avatars.githubusercontent.com/u/162123251?v=4?s=100" width="100px;" alt="liuye20240304"/><br /><sub><b>liuye20240304</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=liuye20240304" title="Documentation">📖</a></td>
1837+
<td align="center" valign="top" width="14.28%"><a href="https://zksync.io"><img src="https://avatars.githubusercontent.com/u/149794418?v=4?s=100" width="100px;" alt="Daniel Lumi"/><br /><sub><b>Daniel Lumi</b></sub></a><br /><a href="#maintenance-zk-Lumi" title="Maintenance">🚧</a></td>
1838+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ZakGriffith"><img src="https://avatars.githubusercontent.com/u/12072395?v=4?s=100" width="100px;" alt="Zak G"/><br /><sub><b>Zak G</b></sub></a><br /><a href="#tutorial-ZakGriffith" title="Tutorials">✅</a></td>
1839+
<td align="center" valign="top" width="14.28%"><a href="http://fanniebarskhian.com"><img src="https://avatars.githubusercontent.com/u/42990794?v=4?s=100" width="100px;" alt="Fannie Barskhian"/><br /><sub><b>Fannie Barskhian</b></sub></a><br /><a href="#maintenance-barskhianfannie" title="Maintenance">🚧</a></td>
1840+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ksdumont"><img src="https://avatars.githubusercontent.com/u/51958351?v=4?s=100" width="100px;" alt="Keith Dumont"/><br /><sub><b>Keith Dumont</b></sub></a><br /><a href="#content-ksdumont" title="Content">🖋</a></td>
18361841
</tr>
18371842
</tbody>
18381843
</table>

docs/applying-storybook.md

Lines changed: 85 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ It's as easy as running `yarn storybook` to boot up a dedicated localhost to see
2222
2323
A Storybook "story" is an instance of a component in a certain state or with certain parameters applied to show an alternative version of the component.
2424

25-
Each component will only need one file containing all the stories.
25+
There may be some exceptions, but generally each component should have only on story file.
2626

2727
The stories file will reside with each component. So the base folder structure in `src` will look like this:
2828

@@ -40,22 +40,23 @@ The initial structure of each story file will look something like this (in types
4040
```tsx
4141
import ComponentA from "."
4242

43-
type ComponentAType = typeof ComponentA
44-
4543
const meta {
4644
title: "ComponentA",
4745
component: ComponentA
48-
} satisfies Meta<ComponentAType>
46+
} satisfies Meta<typeof ComponentA>
4947

5048
export default meta
49+
// Please use `typeof meta` for maximum type safety
5150
type Story = StoryObj<typeof meta>;
5251

53-
export const Basic: Story = {
54-
render: () => <ComponentA />
55-
}
52+
export const Basic: Story = {}
5653
```
5754

58-
**Note**: with the `title` option, we write this based on the groupings set by the Design System. Groupings are declared with forward slashes. (i.e. `Atoms / Form / Input`). See the Storybook docs for details on [Naming conventions](https://storybook.js.org/docs/7.0/react/writing-stories/naming-components-and-hierarchy)
55+
- With the `title` option, we write this based on the groupings set by the Design System. Groupings are declared with forward slashes. (i.e. `Atoms / Form / Input`). See the Storybook docs for details on [Naming conventions](https://storybook.js.org/docs/7.0/react/writing-stories/naming-components-and-hierarchy)
56+
- The `satisfies` TypeScript keyword is used with the `Meta` type for stricter type checking. This is particularly helpful to make sure required args are not missed. [Storybook Docs regarding `satisfies`](https://storybook.js.org/docs/writing-stories/typescript#using-satisfies-for-better-type-safety)
57+
- The use of `StoryObj` is to be able to typecheck the creation of a story as an object. This helps with prop inference.
58+
- We use `StoryObj<typeof meta>` in the event a required arg is provided in the `meta` object, to be applied to all stories in the file. This prevents type errors throwing at the story level for a required missing arg.
59+
- If the story does not need any args or any custom rendering, it should be left as an empty object. Otherwise, use the `render` option to explicitly write the rendering of the story: i.e. `render: () => <Component />`
5960

6061
Also, please view the Figma file for the [proposed structure for the Design System](https://www.figma.com/file/Ne3iAassyfAcJ0AlgqioAP/DS-to-storybook-structure?type=design&node-id=42%3A50&mode=design&t=RGkyouvTilzF42y0-1) to provide the correct groupings.
6162

@@ -71,7 +72,7 @@ import Button from "."
7172
type ButtonType = typeof Button
7273

7374
const meta {
74-
title: "Button",
75+
title: "Atoms / Form / Button",
7576
component: Button
7677
} satisfies Meta<ButtonType>
7778

@@ -98,12 +99,12 @@ export const Outline: Story = {
9899
* This can also be done for various sizes or other like alterations
99100
*
100101
* 🚨 If prop content is supplied directly to the component and the `args` prop is not used,
101-
* do not use the `StoryObj` type. This is especially important when a story rendering multiple versions
102+
* use `StoryObj` without a prop type. This is especially important when a story renders multiple versions
102103
* of the component.
103104
*/
104105

105106
// Assuming `solid` is the default variant in the Chakra theme config
106-
export const Variants = {
107+
export const Variants: StoryObj = {
107108
render: () => (
108109
<VStack>
109110
<Button>A Solid Button</Button>
@@ -116,7 +117,7 @@ export const Variants = {
116117

117118
### Story file containing a single story
118119

119-
If only one story is provided for a component, the name of the exported object should match the name in the `title` meta option. (If the title is `Atoms / Form / Button` then the object should be named `Button`) This will hoist the display name up to the parent level in the Storybook dashboard's sidebar. This will also mean you have to rename the import of the component. Call it `ButtonComponent`, say.
120+
If only one story is provided for a component, the name of the exported object should match the name in the `title` meta option. For example, if the title is `Atoms / Form / Button` then the story should be named `Button`. This will hoist the display name up to the parent level in the Storybook dashboard's sidebar. This will also mean you have to rename the import of the component. Call it `ButtonComponent`, say.
120121

121122
```tsx
122123
import ButtonComponent from "."
@@ -157,3 +158,75 @@ Outlined below are each area going from left to right in the selections.
157158
| 10. A11y Visualization Simulator |
158159
| 11. Set layout direction (left or right) |
159160
| 12. Toggle color mode |
161+
162+
## Chromatic
163+
164+
Chromatic is a visual testing tool that scans every possible UI state across browsers to catch bugs in appearance and functionality. It enables you to assign reviewers and resolve discussions to streamline team sign-off. It is created by the same team that made Storybook. [Read more in the Chromatic docs](https://www.chromatic.com/docs/)
165+
166+
When creating a story, Chromatic creates a "snapshot" of it and sets it as a baseline. This baseline is also approved or denied before merging into the project. Whenever there are changes that affect the component, Chromatic will create a new snapshot to analyze. If there are changes, Chromatic will provide them for a reviewer to accept or decline, and be able to provide any further comments.
167+
168+
### Story Modes
169+
170+
Depending on the component, we might look for more than just one snapshot per story. In some cases, we might want multiple snapshots showing the story rendered at various viewport widths or in different languages, a combination of both, etc. These are referred to as [Story Modes](https://www.chromatic.com/docs/modes/). Examples of applicable components include the `Footer` and the `HubHero`.
171+
172+
You will currently find the setup of these modes in [the `./storybook/modes.ts` file](../.storybook/modes.ts)
173+
174+
> Note: At this time we are only considering modes for viewport and languages. Color mode is not possible with the existing setup and is being investigated on making it available, should we want to use it.
175+
176+
When using a mode at either the component level (all stories in a given file) or at the story level, they are supplied under the `chromatic` parameter.
177+
178+
```tsx
179+
import { Meta, StoryObj } from "@storybook/react"
180+
181+
import { langViewportModes } from "../../../../.storybook/modes"
182+
183+
import ContentHeroComponent, { ContentHeroProps } from "."
184+
185+
const meta = {
186+
title: "Organisms / Layouts / Hero",
187+
component: ContentHeroComponent,
188+
parameters: {
189+
chromatic: {
190+
modes: {
191+
...langViewportModes,
192+
},
193+
},
194+
},
195+
// other options as needed
196+
} satisfies Meta<typeof ContentHeroComponent>
197+
```
198+
199+
In this example, we are supplying all the combinations of the languages and viewports together in snapshots. These will only be viewed in chromatic and cannot be seen when viewing storybook locally.
200+
201+
If needs to be only a couple of options, you can write them like this:
202+
203+
```ts
204+
import { viewportModes, langViewportModes } from "../../../../.storybook/modes"
205+
206+
// In the `meta` object
207+
parameters: {
208+
chromatic: {
209+
modes: {
210+
base: viewportModes['base']
211+
'ru-xl': langViewportModes['ru-xl']
212+
}
213+
}
214+
}
215+
```
216+
217+
### Disabling Snapshots
218+
219+
There may be instances where we would like to save a story for visual testing in local development, but do not want to capture snapshots for regressions. In these cases, enable the `disableSnapshot` option.
220+
221+
This can be applied at any level (project, component, story)
222+
223+
```ts
224+
// At any level
225+
parameters: {
226+
chromatic: {
227+
disableSnapshot: true
228+
}
229+
}
230+
```
231+
232+
> 🚨 NOTE: This will be notated ahead of time by the team which stories should not receive snapshots.

i18n.config.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -344,17 +344,17 @@
344344
"dateFormat": "MM/DD/YYYY"
345345
},
346346
{
347-
"code": "pt",
348-
"crowdinCode": "pt-PT",
349-
"name": "Portuguese",
347+
"code": "pt-br",
348+
"crowdinCode": "pt-BR",
349+
"name": "Portuguese (Brazilian)",
350350
"localName": "Português",
351351
"langDir": "ltr",
352352
"dateFormat": "MM/DD/YYYY"
353353
},
354354
{
355-
"code": "pt-br",
356-
"crowdinCode": "pt-BR",
357-
"name": "Portuguese (Brazilian)",
355+
"code": "pt",
356+
"crowdinCode": "pt-PT",
357+
"name": "Portuguese",
358358
"localName": "Português",
359359
"langDir": "ltr",
360360
"dateFormat": "MM/DD/YYYY"
@@ -487,20 +487,20 @@
487487
"langDir": "ltr",
488488
"dateFormat": "MM/DD/YYYY"
489489
},
490-
{
491-
"code": "zh",
492-
"crowdinCode": "zh-CN",
493-
"name": "Chinese Simplified",
494-
"localName": "简体中文",
495-
"langDir": "ltr",
496-
"dateFormat": "YYYY-MM-DD"
497-
},
498490
{
499491
"code": "zh-tw",
500492
"crowdinCode": "zh-TW",
501493
"name": "Chinese Traditional",
502494
"localName": "繁體中文",
503495
"langDir": "ltr",
504496
"dateFormat": "YYYY-MM-DD"
497+
},
498+
{
499+
"code": "zh",
500+
"crowdinCode": "zh-CN",
501+
"name": "Chinese Simplified",
502+
"localName": "简体中文",
503+
"langDir": "ltr",
504+
"dateFormat": "YYYY-MM-DD"
505505
}
506506
]

0 commit comments

Comments
 (0)