-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7450 from ethereum/dev
Deploy v5.1.0
- Loading branch information
Showing
102 changed files
with
2,900 additions
and
839 deletions.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Chakra migration guide | ||
|
||
This is a reference for migrating our current `styled` components from `emotion` to [Chakra](https://chakra-ui.com/) components. | ||
|
||
This is part of our [UI library implementation epic](https://github.com/ethereum/ethereum-org-website/issues/6374). | ||
|
||
## Replace styled components with Chakra components | ||
|
||
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). | ||
|
||
## Override styles using style props | ||
|
||
- 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) | ||
- Chakra default values are documented here: [https://chakra-ui.com/docs/styled-system/theme](https://chakra-ui.com/docs/styled-system/theme) | ||
|
||
```tsx | ||
// before | ||
const Paragraph = styled.p` | ||
font-size: 1rem; | ||
margin: 1rem; | ||
` | ||
|
||
// now | ||
<Text fontSize="md" margin={4} /> | ||
``` | ||
|
||
## Theme colors | ||
|
||
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. | ||
|
||
```tsx | ||
// before | ||
const Text = styled.p` | ||
color: ${({ theme }) => theme.colors.primary}; | ||
background-color: ${({ theme }) => theme.colors.background}; | ||
` | ||
|
||
// now | ||
<Text color="primary" bg="background" /> | ||
``` | ||
|
||
<aside> | ||
💡 In the **next iteration** we will refactor all the colors with the correct color from the new Design System | ||
</aside> | ||
|
||
## Update dependencies | ||
|
||
- [Deprecated] `src/components/Icon` - use the [Chakra Icon](https://chakra-ui.com/docs/components/icon/usage) instead. | ||
|
||
```tsx | ||
import { Icon } from "@chakra-ui/react" | ||
import { BsQuestionSquareFill } from "react-icons/bs" | ||
;<Icon as={BsQuestionSquareFill} /> | ||
``` | ||
|
||
- [Deprecated]`src/components/SharedStyledComponents` - we are not using this anymore, use Chakra components instead. | ||
|
||
## Do you have any other question? | ||
|
||
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 💪 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "ethereum-org-website", | ||
"version": "5.0.0", | ||
"version": "5.1.0", | ||
"description": "Website of ethereum.org", | ||
"main": "index.js", | ||
"repository": "[email protected]:ethereum/ethereum-org-website.git", | ||
|
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,5 +1,34 @@ | ||
export type Colors = typeof colors | ||
|
||
const colors = {} | ||
const colors = { | ||
grey: { | ||
100: "#f7f7f7", | ||
300: "#d4d4d4", | ||
500: "#646464", | ||
700: "#222222", | ||
900: "#141414", | ||
}, | ||
blue: { | ||
100: "#e8e8ff", | ||
300: "#8d8dff", | ||
500: "#1c1cff", | ||
700: "#0b0b66", | ||
}, | ||
orange: { | ||
100: "#ffe3d3", | ||
300: "#ffb991", | ||
500: "#ff7324", | ||
800: "#451900", | ||
}, | ||
red: { | ||
600: "#b80000", | ||
}, | ||
green: { | ||
500: "#109e62", | ||
}, | ||
yellow: { | ||
200: "#fff8df", | ||
}, | ||
} | ||
|
||
export default colors |
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { | ||
lightTheme as oldLightTheme, | ||
darkTheme as oldDarkTheme, | ||
} from "../../theme" | ||
|
||
const oldLightThemeColors = oldLightTheme.colors | ||
const oldDarkThemeColors = oldDarkTheme.colors | ||
|
||
// define each of the old colors as a `semanticToken`: | ||
// `name: { _light: lightColor, _dark: darkColor }` | ||
const oldColors = Object.keys(oldLightThemeColors).reduce((colors, color) => { | ||
const lightColor = oldLightThemeColors[color] | ||
const darkColor = oldDarkThemeColors[color] | ||
|
||
if (typeof lightColor !== "string" || typeof darkColor !== "string") { | ||
return colors | ||
} | ||
|
||
return { | ||
...colors, | ||
[color]: { _light: lightColor, _dark: darkColor }, | ||
} | ||
}, {}) | ||
|
||
const semanticTokens = { | ||
colors: { | ||
// define old colors from the old theme as semanticTokens to transition | ||
// from emotion components to chakra | ||
// TODO: remove these colors as we migrate away from them | ||
...oldColors, | ||
|
||
// Design System colors | ||
primary: { _light: "blue.500", _dark: "orange.500" }, | ||
primaryDark: { _light: "blue.700", _dark: "orange.800" }, | ||
primaryHover: { _light: "blue.300", _dark: "orange.300" }, | ||
primaryLight: { _light: "blue.100", _dark: "orange.100" }, | ||
body: { _light: "grey.700", _dark: "grey.100" }, | ||
bodyLight: { _light: "grey.500", _dark: "grey.100" }, | ||
disabled: { _light: "grey.300", _dark: "grey.500" }, | ||
background: { _light: "white", _dark: "grey.700" }, | ||
success: "green.500", | ||
error: "red.600", | ||
attention: "yellow.200", | ||
}, | ||
} | ||
|
||
export default semanticTokens |
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
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
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.