Skip to content

Commit 2e9cbfe

Browse files
authored
Merge pull request #12048 from ethereum/update-next-docs
docs: update Next docs
2 parents 35ebc05 + 17d180d commit 2e9cbfe

File tree

9 files changed

+32
-239
lines changed

9 files changed

+32
-239
lines changed

docs/api-keys.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ We recommend setting this up when running the project locally, as we use the Git
1111
1212
```sh
1313
# .env Example:
14-
GATSBY_GITHUB_TOKEN_READ_ONLY=48f84de812090000demo00000000697cf6e6a059
14+
GITHUB_TOKEN_READ_ONLY=48f84de812090000demo00000000697cf6e6a059
1515
```
1616

1717
2. Add Etherscan API token (free)
@@ -25,13 +25,3 @@ GATSBY_GITHUB_TOKEN_READ_ONLY=48f84de812090000demo00000000697cf6e6a059
2525
# .env Example:
2626
ETHERSCAN_API_KEY=K6NUTARFJZJCIXHF1F1E1YGJZ8RQ29BE4U
2727
```
28-
29-
3. Add DeFiPulse API token (free)
30-
31-
> - [Follow this guide](https://docs.defipulse.com/quick-start-guide) to create an account and get your DeFiPulse API token
32-
> - Copy & paste your Active API Key from DeFiPulse into `.env`
33-
34-
```sh
35-
# .env Example:
36-
DEFI_PULSE_API_KEY=4953aaf7966dad9c129397e197a0630ed0594f66962dd5fb058972b250da
37-
```

docs/best-practices.md

Lines changed: 7 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Markdown will be translated as whole pages of content, so no specific action is
5252

5353
- _tl;dr Each individual JSON entry should be a complete phrase by itself_
5454

55-
- This is done using the `Translation` component. However there is an alternative method for regular JS: using the `t` function from `gatsby-plugin-react-i18next`
55+
- This is done using the `Translation` component. However there is an alternative method for regular JS: using the `t` function from `next-i18next`
5656

5757
- **Method one: `<Translation />` component (preferred if only needed in JSX)**
5858

@@ -66,7 +66,7 @@ Markdown will be translated as whole pages of content, so no specific action is
6666
- **Method two: `t()`**
6767

6868
```tsx
69-
import { useTranslation } from "gatsby-plugin-react-i18next"
69+
import { useTranslation } from "next-i18next"
7070
7171
// Utilize anywhere in JS using
7272
const { t } = useTranslation()
@@ -104,7 +104,7 @@ export default ComponentName
104104

105105
We use [Chakra UI](https://chakra-ui.com/).
106106

107-
`src/@chakra-ui/gatsby-plugin/theme.ts` - Holds all the theme configuration. This is where you can find the colors, fonts, component themes, variants, etc.
107+
`src/@chakra-ui/theme.ts` - Holds all the theme configuration. This is where you can find the colors, fonts, component themes, variants, etc.
108108

109109
- Wrappers or layout divs
110110

@@ -149,7 +149,7 @@ Use [the Chakra default breakpoints](https://chakra-ui.com/docs/styled-system/th
149149
<Text color="primary.base" bg="background.base" />
150150
```
151151

152-
> Note the dotted notation. In Chakra, the values are referred to as "semantic tokens" and the new theme applies a nested structure of like tokens for better organization. See [semanticTokens.ts](../src/%40chakra-ui/gatsby-plugin/semanticTokens.ts)
152+
> Note the dotted notation. In Chakra, the values are referred to as "semantic tokens" and the new theme applies a nested structure of like tokens for better organization. See [semanticTokens.ts](../src/@chakra-ui/semanticTokens.ts)
153153

154154
> Note 2: all the previous colors defined in the old theme `src/theme.ts` were
155155
> ported into the new theme for compatibility reasons. Those colors will
@@ -177,63 +177,10 @@ import { BsQuestionSquareFill } from "react-icons/bs"
177177
;<Icon as={BsQuestionSquareFill} />
178178
```
179179

180-
## Image loading and API calls using GraphQL
180+
## Using custom `Image` component
181181

182-
- [Gatsby + GraphQL](https://www.gatsbyjs.com/docs/graphql/) used for loading of images and preferred for API calls (in lieu of REST, if possible/practical). Utilizes static page queries that run at build time, not at run time, optimizing performance.
183-
- Image loading example:
182+
[Next Image](https://nextjs.org/docs/pages/api-reference/components/image) is the component of choice to handle responsive images. However, we use a custom version of this component that is properly optimized with Chakra. This way we can use style props from Chakra but still be able to forward common or Next Image-specific props to the component for correct usage and rendering.
184183

185184
```tsx
186-
import { graphql } from "gatsby"
187-
188-
export const query = graphql`
189-
query {
190-
hero: file(relativePath: { eq: "developers-eth-blocks.png" }) {
191-
childImageSharp {
192-
gatsbyImageData(
193-
width: 800
194-
layout: FIXED
195-
placeholder: BLURRED
196-
quality: 100
197-
)
198-
}
199-
}
200-
}
201-
`
202-
// These query results get passed as an object `props.data` to your component
203-
```
204-
205-
- API call example:
206-
207-
```tsx
208-
import { graphql } from "gatsby"
209-
210-
export const repoInfo = graphql`
211-
fragment repoInfo on GitHub_Repository {
212-
stargazerCount
213-
languages(orderBy: { field: SIZE, direction: DESC }, first: 2) {
214-
nodes {
215-
name
216-
}
217-
}
218-
url
219-
}
220-
`
221-
export const query = graphql`
222-
query {
223-
hardhatGitHub: github {
224-
repository(owner: "nomiclabs", name: "hardhat") {
225-
...repoInfo
226-
}
227-
}
228-
}
229-
`
230-
// These query results get passed as an object `props.data` to your component
231-
```
232-
233-
### Using custom `GatsbyImage`
234-
235-
[GatsbyImage](https://www.gatsbyjs.com/plugins/gatsby-plugin-image/) is the component of choice to handle responsive images processed through graphql. However, we use a custom version of this component that is properly optimized with Chakra. This way we can use style props from Chakra but still be able to forward common or GatsbyImage-specific props to the Gatsby component for correct usage and rendering.
236-
237-
```tsx
238-
import GatsbyImage from "./components/GatsbyImage"
185+
import { Image } from "@/components/Image"
239186
```
File renamed without changes.

docs/ds-implementation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This is part of our [Design System implementation epic](https://github.com/ethe
77
## Basics
88

99
- Use Chakra tokens for spacing, sizes, and breakpoints. [Chakra theme docs](https://chakra-ui.com/docs/styled-system/theme)
10-
- For colors use the semantic tokens defined in [this file](https://github.com/ethereum/ethereum-org-website/blob/dev/src/@chakra-ui/gatsby-plugin/semanticTokens.ts). These tokens will match the color variables used in the DS Figma file
10+
- For colors use the semantic tokens defined in [this file](https://github.com/ethereum/ethereum-org-website/blob/dev/src/%40chakra-ui/semanticTokens.ts). These tokens will match the color variables used in the DS Figma file
1111
- Use as many Chakra components and utils as possible
1212
- Read the [Best Practices doc](https://github.com/ethereum/ethereum-org-website/blob/dev/docs/best-practices.md) for more examples and info
1313

@@ -29,7 +29,7 @@ If you are implementing:
2929

3030
- A base component (a component that already exists in the [Chakra components list](https://chakra-ui.com/docs/components/), for example, the button or inputs)
3131
- Try to avoid creating a new component file `/ComponentA/index.tsx` if there is no additional or custom logic we need to add to them
32-
- Create a theme file to override the default Chakra styles with the DS specs. See examples under the [Chakra theme folder](https://github.com/ethereum/ethereum-org-website/blob/dev/src/@chakra-ui/gatsby-plugin/components/)
32+
- Create a theme file to override the default Chakra styles with the DS specs. See examples under the [Chakra theme folder](https://github.com/ethereum/ethereum-org-website/tree/dev/src/%40chakra-ui/components)
3333
- Create a `.stories.tsx` file under `src/components/BaseStories`
3434
- A new custom component (e.g. the PageHero)
3535
- Use as many Chakra components as possible

docs/event-tracking.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Event tracking is a great way to validate our design decisions and assumptions.
1616

1717
ethereum.org uses Matomo, an open-source alternative to Google Analytics, allowing us to protect user privacy by not sharing any analytics with third parties.
1818

19-
We implemented Matomo using the [JavaScript tracking client](https://developer.matomo.org/guides/tracking-javascript-guide) via the [`gatsby-matomo-plugin`](https://github.com/kremalicious/gatsby-plugin-matomo) Gatsby plugin.
19+
We implemented Matomo using the [JavaScript tracking client](https://developer.matomo.org/guides/tracking-javascript-guide) via the [`@socialgouv/matomo-next`](https://github.com/SocialGouv/matomo-next) package.
2020

2121
## What to measure?
2222

docs/next-docs/stack.md

Lines changed: 0 additions & 38 deletions
This file was deleted.

docs/schema.md

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)