Skip to content

Commit

Permalink
Merge branch 'dev' into post-merge
Browse files Browse the repository at this point in the history
  • Loading branch information
wackerow committed Sep 2, 2022
2 parents 58807dd + 9e6098b commit e5109c4
Show file tree
Hide file tree
Showing 173 changed files with 732 additions and 751 deletions.
9 changes: 9 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -8556,6 +8556,15 @@
"doc",
"translation"
]
},
{
"login": "SavPhill",
"name": "Phill",
"avatar_url": "https://avatars.githubusercontent.com/u/38789408?v=4",
"profile": "https://github.com/SavPhill",
"contributions": [
"content"
]
}
],
"contributorsPerLine": 7,
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1362,6 +1362,9 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<td align="center"><a href="http://stackoverflow.com/users/5062825/ramansb"><img src="https://avatars.githubusercontent.com/u/13969478?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ramandeep</b></sub></a><br /><a href="#ideas-RamanSB" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center"><a href="https://github.com/vvladd"><img src="https://avatars.githubusercontent.com/u/13506999?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vlad Kokhan</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=vvladd" title="Documentation">📖</a> <a href="#translation-vvladd" title="Translation">🌍</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/SavPhill"><img src="https://avatars.githubusercontent.com/u/38789408?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Phill</b></sub></a><br /><a href="#content-SavPhill" title="Content">🖋</a></td>
</tr>
</table>

<!-- markdownlint-restore -->
Expand Down
16 changes: 15 additions & 1 deletion docs/chakra-migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,24 @@ const Text = styled.p`
```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.
- [Deprecated]`src/components/SharedStyledComponents` - we are not using this anymore, replace everything with Chakra components.

```tsx
// before
import { ButtonPrimary, ButtonSecondary } from "../SharedStyledComponents"

// now
import Button from "../Button" // <-- use the new Button component built with Chakra

// use our primary button (uses the default `solid` variant)
<Button />
// or the outline version
<Button variant="outline" />
```

## Do you have any other question?

Expand Down
2 changes: 1 addition & 1 deletion gatsby-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ const config: GatsbyConfig = {
{
resolve: "@chakra-ui/gatsby-plugin",
options: {
resetCSS: false,
resetCSS: true,
isUsingColorMode: true,
},
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ethereum-org-website",
"version": "5.4.0",
"version": "6.0.0",
"description": "Website of ethereum.org",
"main": "index.js",
"repository": "[email protected]:ethereum/ethereum-org-website.git",
Expand Down
74 changes: 74 additions & 0 deletions src/@chakra-ui/gatsby-plugin/components/Button.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import type { ComponentStyleConfig } from "@chakra-ui/theme"

const commonOutline = {
border: "1px",
color: "text",
bg: "transparent",
borderColor: "text",
_hover: {
color: "primary",
bg: "background",
borderColor: "primary",
},
_active: {
color: "primary",
bg: "primaryLight",
borderColor: "primary",
},
_focus: {
color: "primary",
borderColor: "background",
},
_disabled: {
color: "disabled",
borderColor: "disabled",
opacity: 1,
},
}

export const Button: ComponentStyleConfig = {
baseStyle: {
fontWeight: "normal",
borderRadius: "base",
_hover: {
textDecoration: "none",
boxShadow: "primary",
},
_focus: {
boxShadow: "outline",
outline: 0,
},
},
sizes: {
md: {
h: 42,
},
},
variants: {
// solid is the default variant used by chakra
solid: {
color: "buttonColor",
bg: "primary",
border: 0,
_hover: {
bg: "primary",
opacity: 0.8,
},
_active: {
bg: "primaryHover",
},
_disabled: {
bg: "disabled",
opacity: 1,
},
},
outline: {
...commonOutline,
},
"outline-color": {
...commonOutline,
color: "primary",
borderColor: "primary",
},
},
}
15 changes: 15 additions & 0 deletions src/@chakra-ui/gatsby-plugin/components/Link.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { ComponentStyleConfig } from "@chakra-ui/theme"

export const Link: ComponentStyleConfig = {
baseStyle: {
color: "primary",
textDecoration: "underline",
_focus: {
boxShadow: "none",
},
_focusVisible: {
boxShadow: "none",
outline: "auto",
},
},
}
2 changes: 2 additions & 0 deletions src/@chakra-ui/gatsby-plugin/components/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "./Link"
export * from "./Button"
3 changes: 2 additions & 1 deletion src/@chakra-ui/gatsby-plugin/foundations/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const colors = {
grey: {
100: "#f7f7f7",
300: "#d4d4d4",
400: "#b0b0b0",
500: "#646464",
700: "#222222",
900: "#141414",
Expand All @@ -21,7 +22,7 @@ const colors = {
800: "#451900",
},
red: {
600: "#b80000",
500: "#b80000",
},
green: {
500: "#109e62",
Expand Down
4 changes: 4 additions & 0 deletions src/@chakra-ui/gatsby-plugin/foundations/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import colors from "./colors"
import shadows from "./shadows"

// Check the following link to see all the possible options:
// https://github.com/chakra-ui/chakra-ui/blob/main/packages/theme/src/foundations/index.ts
const foundations = {
colors,
shadows,
}

export default foundations
7 changes: 7 additions & 0 deletions src/@chakra-ui/gatsby-plugin/foundations/shadows.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const shadows = {
// using css variables bc shadows do not support color tokens yet
primary: "4px 4px 0px 0px var(--eth-colors-primaryLight)",
outline: "0 0 0 4px var(--eth-colors-primaryHover)",
}

export default shadows
6 changes: 3 additions & 3 deletions src/@chakra-ui/gatsby-plugin/semanticTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ const semanticTokens = {

// Design System colors
primary: { _light: "blue.500", _dark: "orange.500" },
primaryLight: { _light: "blue.100", _dark: "orange.100" },
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" },
disabled: { _light: "grey.400", _dark: "grey.500" },
background: { _light: "white", _dark: "grey.700" },
success: "green.500",
error: "red.600",
error: "red.500",
attention: "yellow.200",
},
}
Expand Down
10 changes: 10 additions & 0 deletions src/@chakra-ui/gatsby-plugin/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import styles from "./styles"
// Foundational style overrides
import foundations from "./foundations"

// Component style overrides
import * as components from "./components"

import semanticTokens from "./semanticTokens"

const config: ThemeConfig = {
Expand All @@ -18,11 +21,18 @@ const config: ThemeConfig = {
useSystemColorMode: true,
}

/**
* Override default styles with our custom theme.
*
* The complete list of default Chakra styles can be found here:
* https://github.com/chakra-ui/chakra-ui/tree/main/packages/theme/src
*/
const theme: ThemeOverride = {
config,
styles,
...foundations,
semanticTokens,
components,
}

export default extendTheme(theme)
1 change: 1 addition & 0 deletions src/components/ActionCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const Card = styled(Link)`
&:hover,
&:focus {
text-decoration: none;
border-radius: 4px;
box-shadow: 0px 8px 17px rgba(0, 0, 0, 0.15);
background: ${(props) => props.theme.colors.tableBackgroundHover};
Expand Down
4 changes: 2 additions & 2 deletions src/components/BeaconChainActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ const BeaconChainActions: React.FC = () => {
<StyledButtonLink to="https://launchpad.ethereum.org">
<Translation id="get-started" />
</StyledButtonLink>
<ButtonLink isSecondary to="/staking/">
<ButtonLink variant="outline" to="/staking/">
<Translation id="page-upgrades-index-staking-learn" />
</ButtonLink>
</StyledCardLeft>
Expand All @@ -168,7 +168,7 @@ const BeaconChainActions: React.FC = () => {
intl
)}
>
<ButtonLink isSecondary to="/upgrades/get-involved/">
<ButtonLink variant="outline" to="/upgrades/get-involved/">
<Translation id="consensus-run-beacon-chain" />
</ButtonLink>
</StyledCardRight>
Expand Down
1 change: 1 addition & 0 deletions src/components/Breadcrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const CrumbLink = styled(Link)`
color: ${(props) => props.theme.colors.textTableOfContents};
&:hover {
text-decoration: none;
color: ${(props) => props.theme.colors.primary};
}
Expand Down
26 changes: 26 additions & 0 deletions src/components/Button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from "react"
import { Button as ChakraButton, ButtonProps } from "@chakra-ui/react"

import { scrollIntoView } from "../utils/scrollIntoView"

export interface IProps extends ButtonProps {
toId?: string
}

const Button: React.FC<IProps> = ({ toId, children, ...props }) => {
const handleOnClick = () => {
if (!toId) {
return
}

scrollIntoView(toId)
}

return (
<ChakraButton onClick={handleOnClick} {...props}>
{children}
</ChakraButton>
)
}

export default Button
27 changes: 6 additions & 21 deletions src/components/ButtonDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import React, { useState, createRef } from "react"
import styled from "@emotion/styled"
import { useIntl } from "react-intl"
import { motion } from "framer-motion"
import { MdMenu } from "react-icons/md"

// Components
import Icon from "./Icon"
import Link from "./Link"
import Button from "./Button"
import Translation from "./Translation"
import { ButtonSecondary } from "./SharedStyledComponents"

// Utils
import { useOnClickOutside } from "../hooks/useOnClickOutside"
Expand Down Expand Up @@ -65,24 +65,6 @@ const listVariants = {
},
}

const Button = styled(ButtonSecondary)`
display: flex;
align-items: center;
justify-content: space-around;
min-width: 240px;
@media (max-width: ${(props) => props.theme.breakpoints.l}) {
width: 100%;
justify-content: center;
}
`

const StyledIcon = styled(Icon)`
fill: ${(props) => props.theme.colors.text};
@media (max-width: ${(props) => props.theme.breakpoints.l}) {
margin-right: 1rem;
}
`

const DropdownItem = styled.li`
margin: 0;
color: ${(props) => props.theme.colors.text};
Expand All @@ -98,6 +80,7 @@ const NavLink = styled(Link)`
padding: 0.5rem;
color: ${(props) => props.theme.colors.text};
&:hover {
text-decoration: none;
color: ${(props) => props.theme.colors.primary};
}
`
Expand Down Expand Up @@ -156,11 +139,13 @@ const ButtonDropdown: React.FC<IProps> = ({ list, className }) => {
aria-label={`Select ${translateMessageId(list.text, intl)}`}
>
<Button
variant="outline"
minW={{ base: "100%", lg: "240" }}
leftIcon={<MdMenu />}
onClick={() => setIsOpen(!isOpen)}
onKeyDown={onKeyDownHandler}
tabIndex={0}
>
<StyledIcon name="menu" />
<Translation id={list.text} />
</Button>
<DropdownList
Expand Down
Loading

0 comments on commit e5109c4

Please sign in to comment.