Skip to content

Commit cf15907

Browse files
authored
Merge pull request #7450 from ethereum/dev
Deploy v5.1.0
2 parents 3a60904 + f47768e commit cf15907

File tree

102 files changed

+2900
-839
lines changed

Some content is hidden

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

102 files changed

+2900
-839
lines changed

.all-contributorsrc

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8395,6 +8395,53 @@
83958395
"contributions": [
83968396
"doc"
83978397
]
8398+
},
8399+
{
8400+
"login": "hughcrt",
8401+
"name": "Hugh",
8402+
"avatar_url": "https://avatars.githubusercontent.com/u/24587702?v=4",
8403+
"profile": "http://hugh.sh",
8404+
"contributions": [
8405+
"doc"
8406+
]
8407+
},
8408+
{
8409+
"login": "z3zzz",
8410+
"name": "Kim Kwangtae",
8411+
"avatar_url": "https://avatars.githubusercontent.com/u/91174156?v=4",
8412+
"profile": "https://github.com/z3zzz",
8413+
"contributions": [
8414+
"content"
8415+
]
8416+
},
8417+
{
8418+
"login": "tobi4021",
8419+
"name": "tobi4021",
8420+
"avatar_url": "https://avatars.githubusercontent.com/u/84390698?v=4",
8421+
"profile": "https://github.com/tobi4021",
8422+
"contributions": [
8423+
"doc"
8424+
]
8425+
},
8426+
{
8427+
"login": "lonelyotter",
8428+
"name": "Haochen Song",
8429+
"avatar_url": "https://avatars.githubusercontent.com/u/57280827?v=4",
8430+
"profile": "https://github.com/lonelyotter",
8431+
"contributions": [
8432+
"doc",
8433+
"translation"
8434+
]
8435+
},
8436+
{
8437+
"login": "opensourcex123",
8438+
"name": "N Fx",
8439+
"avatar_url": "https://avatars.githubusercontent.com/u/73230562?v=4",
8440+
"profile": "https://github.com/opensourcex123",
8441+
"contributions": [
8442+
"doc",
8443+
"translation"
8444+
]
83988445
}
83998446
],
84008447
"contributorsPerLine": 7,

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,6 +1340,13 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
13401340
<td align="center"><a href="https://pandapip1.com/"><img src="https://avatars.githubusercontent.com/u/45835846?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Pandapip1</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=Pandapip1" title="Documentation">📖</a></td>
13411341
<td align="center"><a href="http://aldizh.github.io/"><img src="https://avatars.githubusercontent.com/u/2282120?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Aldi Zhupani</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/issues?q=author%3AAldizh" title="Bug reports">🐛</a> <a href="https://github.com/ethereum/ethereum-org-website/commits?author=Aldizh" title="Code">💻</a></td>
13421342
<td align="center"><a href="https://github.com/linhuatan"><img src="https://avatars.githubusercontent.com/u/94831627?v=4?s=100" width="100px;" alt=""/><br /><sub><b>linhuatan</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=linhuatan" title="Documentation">📖</a></td>
1343+
<td align="center"><a href="http://hugh.sh"><img src="https://avatars.githubusercontent.com/u/24587702?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Hugh</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=hughcrt" title="Documentation">📖</a></td>
1344+
<td align="center"><a href="https://github.com/z3zzz"><img src="https://avatars.githubusercontent.com/u/91174156?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kim Kwangtae</b></sub></a><br /><a href="#content-z3zzz" title="Content">🖋</a></td>
1345+
<td align="center"><a href="https://github.com/tobi4021"><img src="https://avatars.githubusercontent.com/u/84390698?v=4?s=100" width="100px;" alt=""/><br /><sub><b>tobi4021</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=tobi4021" title="Documentation">📖</a></td>
1346+
</tr>
1347+
<tr>
1348+
<td align="center"><a href="https://github.com/lonelyotter"><img src="https://avatars.githubusercontent.com/u/57280827?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Haochen Song</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=lonelyotter" title="Documentation">📖</a> <a href="#translation-lonelyotter" title="Translation">🌍</a></td>
1349+
<td align="center"><a href="https://github.com/opensourcex123"><img src="https://avatars.githubusercontent.com/u/73230562?v=4?s=100" width="100px;" alt=""/><br /><sub><b>N Fx</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=opensourcex123" title="Documentation">📖</a> <a href="#translation-opensourcex123" title="Translation">🌍</a></td>
13431350
</tr>
13441351
</table>
13451352

docs/chakra-migration-guide.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Chakra migration guide
2+
3+
This is a reference for migrating our current `styled` components from `emotion` to [Chakra](https://chakra-ui.com/) components.
4+
5+
This is part of our [UI library implementation epic](https://github.com/ethereum/ethereum-org-website/issues/6374).
6+
7+
## Replace styled components with Chakra components
8+
9+
All `styled` components need to be removed and replaced with the corresponded Chakra component. [See the list of components](https://chakra-ui.com/docs/components).
10+
11+
## Override styles using style props
12+
13+
- You can see how to use the different style props here: [https://chakra-ui.com/docs/styled-system/style-props](https://chakra-ui.com/docs/styled-system/style-props#margin-and-padding)
14+
- Chakra default values are documented here: [https://chakra-ui.com/docs/styled-system/theme](https://chakra-ui.com/docs/styled-system/theme)
15+
16+
```tsx
17+
// before
18+
const Paragraph = styled.p`
19+
font-size: 1rem;
20+
margin: 1rem;
21+
`
22+
23+
// now
24+
<Text fontSize="md" margin={4} />
25+
```
26+
27+
## Theme colors
28+
29+
All the previous colors defined in the old theme `src/theme.ts` were ported into the new theme as well. Use the same color variables.
30+
31+
```tsx
32+
// before
33+
const Text = styled.p`
34+
color: ${({ theme }) => theme.colors.primary};
35+
background-color: ${({ theme }) => theme.colors.background};
36+
`
37+
38+
// now
39+
<Text color="primary" bg="background" />
40+
```
41+
42+
<aside>
43+
💡 In the **next iteration** we will refactor all the colors with the correct color from the new Design System
44+
</aside>
45+
46+
## Update dependencies
47+
48+
- [Deprecated] `src/components/Icon` - use the [Chakra Icon](https://chakra-ui.com/docs/components/icon/usage) instead.
49+
50+
```tsx
51+
import { Icon } from "@chakra-ui/react"
52+
import { BsQuestionSquareFill } from "react-icons/bs"
53+
;<Icon as={BsQuestionSquareFill} />
54+
```
55+
56+
- [Deprecated]`src/components/SharedStyledComponents` - we are not using this anymore, use Chakra components instead.
57+
58+
## Do you have any other question?
59+
60+
Ping us in Discord, in the `#ui-library-migration` channel, or leave a comment here or in your opened PR, and we can help you out 💪

docs/typescript.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,24 @@ When we reach the moment where the entire codebase is in TS, we will enable `noI
99

1010
This is just starting, any suggestion is always welcomed and appreciated.
1111

12+
## Declaring types for variables
13+
14+
When declaring types for variables, you should only declare a type when it isn't obvious and the type can't be inferred.
15+
16+
```
17+
// Do not use
18+
const someVar: string = 'string'
19+
20+
// Use
21+
const someVar = 'string'
22+
```
23+
24+
Do declare a type for an unassigned variable when a type can not be inferred.
25+
26+
```
27+
const someVar: string
28+
```
29+
1230
## Migration guide & contribution opportunity 🎉
1331

1432
We'd love your help in migrating our codebase!

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ethereum-org-website",
3-
"version": "5.0.0",
3+
"version": "5.1.0",
44
"description": "Website of ethereum.org",
55
"main": "index.js",
66
"repository": "git@github.com:ethereum/ethereum-org-website.git",
Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,34 @@
11
export type Colors = typeof colors
22

3-
const colors = {}
3+
const colors = {
4+
grey: {
5+
100: "#f7f7f7",
6+
300: "#d4d4d4",
7+
500: "#646464",
8+
700: "#222222",
9+
900: "#141414",
10+
},
11+
blue: {
12+
100: "#e8e8ff",
13+
300: "#8d8dff",
14+
500: "#1c1cff",
15+
700: "#0b0b66",
16+
},
17+
orange: {
18+
100: "#ffe3d3",
19+
300: "#ffb991",
20+
500: "#ff7324",
21+
800: "#451900",
22+
},
23+
red: {
24+
600: "#b80000",
25+
},
26+
green: {
27+
500: "#109e62",
28+
},
29+
yellow: {
30+
200: "#fff8df",
31+
},
32+
}
433

534
export default colors
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import {
2+
lightTheme as oldLightTheme,
3+
darkTheme as oldDarkTheme,
4+
} from "../../theme"
5+
6+
const oldLightThemeColors = oldLightTheme.colors
7+
const oldDarkThemeColors = oldDarkTheme.colors
8+
9+
// define each of the old colors as a `semanticToken`:
10+
// `name: { _light: lightColor, _dark: darkColor }`
11+
const oldColors = Object.keys(oldLightThemeColors).reduce((colors, color) => {
12+
const lightColor = oldLightThemeColors[color]
13+
const darkColor = oldDarkThemeColors[color]
14+
15+
if (typeof lightColor !== "string" || typeof darkColor !== "string") {
16+
return colors
17+
}
18+
19+
return {
20+
...colors,
21+
[color]: { _light: lightColor, _dark: darkColor },
22+
}
23+
}, {})
24+
25+
const semanticTokens = {
26+
colors: {
27+
// define old colors from the old theme as semanticTokens to transition
28+
// from emotion components to chakra
29+
// TODO: remove these colors as we migrate away from them
30+
...oldColors,
31+
32+
// Design System colors
33+
primary: { _light: "blue.500", _dark: "orange.500" },
34+
primaryDark: { _light: "blue.700", _dark: "orange.800" },
35+
primaryHover: { _light: "blue.300", _dark: "orange.300" },
36+
primaryLight: { _light: "blue.100", _dark: "orange.100" },
37+
body: { _light: "grey.700", _dark: "grey.100" },
38+
bodyLight: { _light: "grey.500", _dark: "grey.100" },
39+
disabled: { _light: "grey.300", _dark: "grey.500" },
40+
background: { _light: "white", _dark: "grey.700" },
41+
success: "green.500",
42+
error: "red.600",
43+
attention: "yellow.200",
44+
},
45+
}
46+
47+
export default semanticTokens

src/@chakra-ui/gatsby-plugin/theme.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import styles from "./styles"
1010
// Foundational style overrides
1111
import foundations from "./foundations"
1212

13+
import semanticTokens from "./semanticTokens"
14+
1315
const config: ThemeConfig = {
1416
cssVarPrefix: "eth",
1517
initialColorMode: "light",
@@ -20,6 +22,7 @@ const theme: ThemeOverride = {
2022
config,
2123
styles,
2224
...foundations,
25+
semanticTokens,
2326
}
2427

2528
export default extendTheme(theme)

src/components/FindWallet/WalletFilterSidebar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ const WalletFilterSidebar = ({
350350
],
351351
},
352352
{
353-
title: "Onboard / offboard",
353+
title: "Buy crypto / Sell for fiat",
354354
open: true,
355355
items: [
356356
{

src/components/FindWallet/WalletPersonasSidebar.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -163,21 +163,22 @@ const IconContainer = styled.div`
163163
`
164164

165165
const StyledIcon = styled(Icon)<{ selected: boolean }>`
166-
width: 1.3rem;
167-
height: 1.3rem;
166+
border-radius: 100%;
167+
width: 1rem;
168+
height: 1rem;
168169
margin: 0 0.25rem;
169170
fill: ${(props) =>
170-
props.selected === true ? props.theme.colors.white : "rgba(0, 0, 0, 0)"};
171+
props.selected === true ? props.theme.colors.primary : "rgba(0, 0, 0, 0)"};
171172
background: ${(props) =>
172173
props.selected === true
173174
? props.theme.colors.primary
174175
: props.theme.colors.priceCardBackground};
175-
border-radius: 4px;
176-
border: 1px solid
176+
outline: 1.5px solid
177177
${(props) =>
178178
props.selected === true
179179
? props.theme.colors.primary
180180
: props.theme.colors.text};
181+
outline-offset: 3px;
181182
`
182183

183184
// Types
@@ -273,7 +274,7 @@ const filterLabels = {
273274
icon: <BuyCrypto />,
274275
},
275276
withdraw_crypto: {
276-
label: "Withdraw crypto",
277+
label: "Sell for fiat",
277278
icon: <WithdrawCrypto />,
278279
},
279280
multisig: {
@@ -289,7 +290,7 @@ const filterLabels = {
289290
icon: <ERC20Support />,
290291
},
291292
eip_1559_support: {
292-
label: "EIP-1559 support",
293+
label: "Fee optimization",
293294
icon: <Eip1559 />,
294295
},
295296
}
@@ -533,7 +534,7 @@ const WalletPersonasSidebar = ({
533534
aria-label={`${persona.title} filter`}
534535
>
535536
<StyledIcon
536-
name="check"
537+
name="circle"
537538
selected={selectedPersona === idx}
538539
size="2rem"
539540
/>

0 commit comments

Comments
 (0)