Skip to content

Commit f4277eb

Browse files
authored
Merge branch 'dev' into redirects
2 parents 69c1e45 + 4d1f0fc commit f4277eb

Some content is hidden

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

79 files changed

+8263
-2109
lines changed

.github/labeler.yml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,42 @@
11
"review needed :eyes:":
22
- src/**/*
3+
- public/*
34

45
"documentation :book:":
56
- README.md
67

78
"tooling :wrench:":
89
- .github/**/*
910
- src/scripts/*
10-
- netlify.toml
11+
- src/lib/*
12+
- src/hooks/*
1113

1214
"dependencies :package:":
1315
- package.json
1416
- yarn.lock
1517

1618
"internal :house:":
17-
- gatsby-browser.js
18-
- gatsby-config.js
19-
- gatsby-node.js
20-
- gatsby-ssr.js
2119
- .all-contributorsrc
20+
- i18n.config.json
21+
- next.config.js
22+
- next-i18next.config,js
23+
- next-sitemap.config.js
24+
- tsconfig.json
25+
- .nvmrc
26+
- .eslintignore
27+
- .eslintrc.json
28+
- .prettierignore
29+
- .prettierrc
30+
- netlify.toml
2231

2332
"translation :earth_africa:":
24-
- /content/translations/**/*
25-
- src/intl/*
26-
- src/utils/translations.js
33+
- src/content/translations/**/*
34+
- src/intl/**/*
35+
- src/lib/utils/translations.ts
2736

2837
"content :fountain_pen:":
2938
- src/pages/*
30-
- src/pages-conditional/*
31-
- /content/**/*
39+
- public/content/**/*
3240

3341
"event :date:":
3442
- src/data/community-events.json

src/components/BeaconChainActions.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const H3: React.FC<{ children: React.ReactNode }> = ({ children }) => (
2525
const BeaconChainActions: React.FC = () => {
2626
const { t } = useTranslation(["page-upgrades-index", "page-upgrades"])
2727

28-
const datapoints: Array<CardListItem> = [
28+
const datapoints: CardListItem[] = [
2929
{
3030
title: t("consensus-beaconscan-title"),
3131
image: beaconscan,
@@ -43,7 +43,7 @@ const BeaconChainActions: React.FC = () => {
4343
]
4444

4545
//TODO: we should refactor the naming here instead of using authors into the description field
46-
const reads: Array<CardListItem> = [
46+
const reads: CardListItem[] = [
4747
{
4848
title: t("page-upgrade-article-title-two-point-oh"),
4949
description: t("page-upgrade-article-author-status"),

src/components/Buttons/Button.tsx

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
1-
import React from "react"
21
import {
32
Button as ChakraButton,
4-
ButtonProps,
3+
ButtonProps as ChakraButtonProps,
54
forwardRef,
65
} from "@chakra-ui/react"
76

87
import { type MatomoEventOptions, trackCustomEvent } from "@/lib/utils/matomo"
98
import { scrollIntoView } from "@/lib/utils/scrollIntoView"
109

11-
export const checkIsSecondary = (props: {
10+
export const checkIsSecondary = ({
11+
variant,
12+
isSecondary,
13+
}: {
1214
variant?: string
1315
isSecondary?: boolean
1416
}) => {
15-
const { variant, isSecondary } = props
1617
// These two variants do not have secondary styling, so prevent overrides
1718
return {
1819
"data-secondary":
1920
!["solid", "link"].includes(variant || "solid") && isSecondary,
2021
}
2122
}
2223

23-
export interface IProps extends ButtonProps {
24+
export type ButtonProps = ChakraButtonProps & {
2425
/**
2526
* Set string value that matches the `id` attribute value used
2627
* on another element in a given page. Selecting the button will then
@@ -37,24 +38,27 @@ export interface IProps extends ButtonProps {
3738
customEventOptions?: MatomoEventOptions
3839
}
3940

40-
const Button = forwardRef<IProps, "button">((props, ref) => {
41-
const { toId, onClick, isSecondary, customEventOptions, ...rest } = props
41+
const Button = forwardRef<ButtonProps, "button">(
42+
({ toId, onClick, isSecondary, customEventOptions, ...props }, ref) => {
43+
const handleOnClick = (e: React.MouseEvent<HTMLButtonElement>) => {
44+
toId && scrollIntoView(toId)
45+
customEventOptions && trackCustomEvent(customEventOptions)
4246

43-
const handleOnClick = (e: React.MouseEvent<HTMLButtonElement>) => {
44-
toId && scrollIntoView(toId)
45-
customEventOptions && trackCustomEvent(customEventOptions)
47+
onClick?.(e)
48+
}
4649

47-
onClick?.(e)
50+
return (
51+
<ChakraButton
52+
ref={ref}
53+
onClick={handleOnClick}
54+
{...checkIsSecondary({
55+
variant: props.variant?.toString(),
56+
isSecondary,
57+
})}
58+
{...props}
59+
/>
60+
)
4861
}
49-
50-
return (
51-
<ChakraButton
52-
ref={ref}
53-
onClick={handleOnClick}
54-
{...checkIsSecondary({ variant: rest.variant?.toString(), isSecondary })}
55-
{...rest}
56-
/>
57-
)
58-
})
62+
)
5963

6064
export default Button

src/components/Buttons/ButtonLink.tsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
1-
import React from "react"
1+
import Button, { type ButtonProps } from "@/components/Buttons/Button"
2+
import { BaseLink, type LinkProps } from "@/components/Link"
23

3-
import { BaseLink, LinkProps } from "../Link"
4+
import { type MatomoEventOptions, trackCustomEvent } from "@/lib/utils/matomo"
45

5-
import type { IProps as IButtonProps } from "./Button"
6-
import Button from "./Button"
6+
export type ButtonLinkProps = LinkProps &
7+
Omit<ButtonProps, "toId" | "onClick"> & {
8+
customEventOptions?: MatomoEventOptions
9+
}
710

8-
export type ButtonLinkProps = LinkProps & Omit<IButtonProps, "toId">
9-
10-
const ButtonLink: React.FC<ButtonLinkProps> = (props) => {
11-
return <Button as={BaseLink} activeStyle={{}} {...props} />
11+
const ButtonLink = ({ customEventOptions, ...props }: ButtonLinkProps) => {
12+
const handleClick = () => {
13+
customEventOptions && trackCustomEvent(customEventOptions)
14+
}
15+
return (
16+
<Button as={BaseLink} activeStyle={{}} {...props} onClick={handleClick} />
17+
)
1218
}
1319

1420
export default ButtonLink

src/components/Buttons/ButtonTwoLines/ButtonTwoLines.stories.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import * as React from "react"
21
import { BiCircle } from "react-icons/bi"
32
import { Stack } from "@chakra-ui/react"
43
import { Meta, StoryObj } from "@storybook/react"

src/components/Buttons/ButtonTwoLines/index.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import * as React from "react"
21
import type { IconType } from "react-icons/lib"
32
import { Icon, Stack, Text } from "@chakra-ui/react"
43

5-
import Button, { type IProps as ButtonProps } from "../Button"
6-
import ButtonLink, { type ButtonLinkProps } from "../ButtonLink"
4+
import { Button, type ButtonProps } from "@/components/Buttons"
5+
import ButtonLink, {
6+
type ButtonLinkProps,
7+
} from "@/components/Buttons/ButtonLink"
78

89
type CommonProps = {
910
icon: IconType | typeof Icon
@@ -85,7 +86,7 @@ const ButtonTwoLines = (props: ButtonTwoLinesProps) => {
8586
}}
8687
>
8788
<Stack
88-
spacing={0}
89+
spacing="0"
8990
flexDir={reverseTextOrder ? "column-reverse" : "column"}
9091
>
9192
<Text

src/components/Buttons/IconButton.tsx

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
1-
import * as React from "react"
21
import {
32
IconButton as ChakraIconButton,
43
IconButtonProps as ChakraIconButtonProps,
54
} from "@chakra-ui/react"
65

7-
import { checkIsSecondary, IProps as IButtonProps } from "./Button"
6+
import { type ButtonProps, checkIsSecondary } from "@/components/Buttons"
87

9-
interface IconButtonProps
10-
extends Omit<IButtonProps, keyof ChakraIconButtonProps>,
11-
ChakraIconButtonProps {}
8+
type IconButtonProps = Omit<ButtonProps, keyof ChakraIconButtonProps> &
9+
ChakraIconButtonProps
1210

13-
const IconButton = (props: IconButtonProps) => {
14-
const { isSecondary, ...rest } = props
15-
return (
16-
<ChakraIconButton
17-
{...checkIsSecondary({ variant: rest.variant?.toString(), isSecondary })}
18-
{...rest}
19-
/>
20-
)
21-
}
11+
const IconButton = ({ isSecondary, ...props }: IconButtonProps) => (
12+
<ChakraIconButton
13+
{...checkIsSecondary({ variant: props.variant?.toString(), isSecondary })}
14+
{...props}
15+
/>
16+
)
2217

2318
export default IconButton

src/components/Buttons/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export { default as Button, type IProps as IButtonProps } from "./Button"
1+
export { default as Button, type ButtonProps, checkIsSecondary } from "./Button"
22
export { default as ButtonLink, type ButtonLinkProps } from "./ButtonLink"
33
export { default as ButtonTwoLines } from "./ButtonTwoLines"
44
export { default as IconButton } from "./IconButton"

src/components/CalloutBanner.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Image, type ImageProps } from "@/components/Image"
77
import OldHeading from "@/components/OldHeading"
88
import Text from "@/components/OldText"
99

10-
export interface IProps extends FlexProps {
10+
export type CalloutBannerProps = FlexProps & {
1111
children?: React.ReactNode
1212
image: ImageProps["src"]
1313
imageWidth?: ImageProps["width"]
@@ -17,16 +17,16 @@ export interface IProps extends FlexProps {
1717
alt: string
1818
}
1919

20-
const CalloutBanner: React.FC<IProps> = ({
20+
const CalloutBanner = ({
2121
image,
2222
imageWidth,
2323
maxImageWidth,
2424
titleKey,
2525
descriptionKey,
2626
alt,
2727
children,
28-
...restProps
29-
}) => {
28+
...props
29+
}: CalloutBannerProps) => {
3030
const { t } = useTranslation("page-staking")
3131

3232
return (
@@ -36,15 +36,14 @@ const CalloutBanner: React.FC<IProps> = ({
3636
bg="layer2Gradient"
3737
p={{ base: 8, sm: 12 }}
3838
borderRadius="base"
39-
{...restProps}
39+
{...props}
4040
>
4141
{image && (
4242
<Flex>
4343
<Image
4444
src={image}
4545
alt={alt}
4646
w={imageWidth}
47-
maxW={`${maxImageWidth}px`}
4847
style={{
4948
objectFit: "contain",
5049
}}

src/components/CardList.tsx

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1+
import Image, { type ImageProps } from "next/image"
12
import type { ReactNode } from "react"
23
import {
34
Box,
4-
BoxProps,
5+
type BoxProps,
56
Flex,
67
HStack,
78
LinkBox,
89
LinkOverlay,
9-
StackProps,
10+
type StackProps,
1011
useColorModeValue,
1112
} from "@chakra-ui/react"
1213

13-
import { Image, type ImageProps } from "@/components/Image"
1414
import { BaseLink } from "@/components/Link"
1515

1616
import * as url from "@/lib/utils/url"
@@ -43,18 +43,26 @@ const CardContainer = (props: StackProps) => (
4343
/>
4444
)
4545

46-
const Card = (props: CardListItem & Omit<StackProps, "title" | "id">) => {
47-
const { title, description, caption, link, image, alt, ...rest } = props
48-
const { flipForRtl } = useRtlFlip()
46+
type CardProps = CardListItem & Omit<StackProps, "title" | "id">
4947

48+
const Card = ({
49+
title,
50+
description,
51+
caption,
52+
link,
53+
image,
54+
alt,
55+
...props
56+
}: CardProps) => {
57+
const { flipForRtl } = useRtlFlip()
5058
const isLink = !!link
5159
const isExternal = url.isExternal(link || "")
5260

5361
const descriptionColor = useColorModeValue("gray.500", "gray.400")
5462

5563
return (
56-
<CardContainer {...rest}>
57-
{image && <Image src={image} alt={alt ?? ""} minW="20px" />}
64+
<CardContainer {...props}>
65+
{image && <Image src={image} alt={alt ?? ""} width={20} />}
5866
<Flex flex="1 1 75%" direction="column">
5967
{isLink ? (
6068
<LinkOverlay
@@ -87,17 +95,17 @@ const Card = (props: CardListItem & Omit<StackProps, "title" | "id">) => {
8795
)
8896
}
8997

90-
export interface IProps extends BoxProps {
91-
items: Array<CardListItem>
98+
export type CardListProps = BoxProps & {
99+
items: CardProps[]
92100
clickHandler?: (idx: string | number) => void
93101
}
94102

95-
const CardList: React.FC<IProps> = ({
103+
const CardList = ({
96104
items,
97105
clickHandler = () => null,
98-
...rest
99-
}) => (
100-
<Box bg="background.base" w="full" {...rest}>
106+
...props
107+
}: CardListProps) => (
108+
<Box bg="background.base" w="full" {...props}>
101109
{items.map((listItem, idx) => {
102110
const { link, id } = listItem
103111
const isLink = !!link

0 commit comments

Comments
 (0)