Skip to content

Commit 84c6a05

Browse files
authored
Add JSON files for global translations + make the index page translatable + misc. improvements & fixes (#44)
* Display language dropdown * Update dependencies * Manually translate nav item groups * Fix CODEOWNERS for real * Update dependencies + native language names in dropdown * Style tweaks to right nav and language switcher * Color tweaks * Add EditPageLink component * Comment out LocaleDropdown * Show language switcher * Update `@edgeandnode/components` + lots of i18n improvements * Deploy `develop` to staging * Add Vietnamese locale * Update dependencies * Do not deploy subsequent `develop` commits to staging * Hide language switcher
1 parent 73c6686 commit 84c6a05

Some content is hidden

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

82 files changed

+1323
-3304
lines changed

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"extends": "next/core-web-vitals",
33
"rules": {
4-
"import/no-anonymous-default-export": "off",
4+
"react/self-closing-comp": "error",
55
"@next/next/no-img-element": "off"
66
}
77
}

components/Blockquote.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { HTMLAttributes } from 'react'
2-
import { Spacing, buildBorder } from '@edgeandnode/components'
3-
4-
import { Text, TextProps } from '@/components'
2+
import { Text, TextProps, Spacing, buildBorder } from '@edgeandnode/components'
53

64
export type BlockquoteProps = Omit<TextProps & HTMLAttributes<HTMLQuoteElement>, 'color'>
75

@@ -12,11 +10,8 @@ export const Blockquote = ({ children, ...props }: BlockquoteProps) => {
1210
sx={{
1311
my: Spacing.XL,
1412
p: Spacing.L_XL,
15-
borderLeft: buildBorder('Purple', '4px' as any),
13+
borderLeft: buildBorder('Purple', '4px'),
1614
bg: 'Purple8',
17-
'& > p': {
18-
my: 0,
19-
},
2015
}}
2116
{...props}
2217
>

components/Diamond.tsx

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

components/Difficulty.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1+
import { useI18n } from '@/hooks'
2+
3+
// TODO: Refactor this component
14
export const Difficulty = ({ level }: { level: string }) => {
5+
const { translations } = useI18n()
6+
27
return (
38
<div
49
sx={{
@@ -16,7 +21,7 @@ export const Difficulty = ({ level }: { level: string }) => {
1621
margin: 0,
1722
}}
1823
>
19-
Technical Level Required
24+
{translations.global.technicalLevelRequired}
2025
</p>
2126
<div
2227
sx={{

components/Divider.tsx

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

components/Dropdown.tsx

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

components/EditPageLink.tsx

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,30 @@
11
import { HTMLAttributes } from 'react'
2-
import { Spacing, BorderRadius, Flex, Icon, buildShadow } from '@edgeandnode/components'
2+
import {
3+
Text,
4+
Flex,
5+
Icon,
6+
Spacing,
7+
BorderRadius,
8+
Opacity,
9+
buildShadow,
10+
buildTransition,
11+
useUniqueId,
12+
} from '@edgeandnode/components'
313

4-
import { Text, Link } from '@/components'
5-
import { useLocale } from '@/hooks'
14+
import { Link } from '@/components'
15+
import { useI18n } from '@/hooks'
616

717
export type EditPageLinkProps = {
818
mobile?: boolean
919
} & Omit<HTMLAttributes<HTMLElement>, 'children'>
1020

1121
export const EditPageLink = ({ mobile = false, ...props }: EditPageLinkProps) => {
12-
const { currentLocale, currentPathWithoutLocale } = useLocale()
22+
const { currentLocale, currentPathWithoutLocale, translations } = useI18n()
23+
const linkClass = useUniqueId('class')
1324

1425
return (
1526
<Link
27+
className={linkClass}
1628
href={`https://github.com/graphprotocol/docs/blob/main/pages/${currentLocale}${currentPathWithoutLocale}${
1729
currentPathWithoutLocale.endsWith('/') ? 'index' : ''
1830
}.mdx`}
@@ -22,14 +34,22 @@ export const EditPageLink = ({ mobile = false, ...props }: EditPageLinkProps) =>
2234
py: Spacing.S,
2335
borderRadius: BorderRadius.S,
2436
'&:hover': { color: 'White', textShadow: buildShadow('M') },
25-
transition: 'color 200ms, text-shadow 200ms',
37+
transition: buildTransition(),
2638
}}
39+
{...props}
2740
>
2841
<Flex.Row as="span" align="center" gap={Spacing.M}>
2942
<Icon.LogoGitHub />
30-
<Text weight={mobile ? 'Semibold' : 'Normal'} size={mobile ? '16px' : '14px'}>
31-
Edit page
43+
<Text weight="Semibold" size={mobile ? '16px' : '14px'}>
44+
{translations.global.editPage}
3245
</Text>
46+
<Icon.ExternalLink
47+
sx={{
48+
opacity: Opacity['0%'],
49+
[`.${linkClass}:hover &`]: { opacity: Opacity['32%'] },
50+
transition: buildTransition('OPACITY'),
51+
}}
52+
/>
3353
</Flex.Row>
3454
</Link>
3555
)

0 commit comments

Comments
 (0)