Skip to content

Commit de0fe10

Browse files
authored
Merge branch 'staging' into writingcohortbug
2 parents 2be79ba + 3de8933 commit de0fe10

21 files changed

+98
-70
lines changed

src/@chakra-ui/gatsby-plugin/theme.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import {
2-
extendBaseTheme,
3-
type ThemeConfig,
4-
type ThemeOverride,
5-
} from "@chakra-ui/react"
1+
import { extendBaseTheme, type ThemeConfig } from "@chakra-ui/react"
62

73
// Global style overrides
84
import styles from "./styles"
@@ -27,7 +23,7 @@ const config: ThemeConfig = {
2723
* The complete list of default Chakra styles can be found here:
2824
* https://github.com/chakra-ui/chakra-ui/tree/main/packages/theme/src
2925
*/
30-
const theme: ThemeOverride = {
26+
const theme = {
3127
config,
3228
styles,
3329
...foundations,

src/components/BeaconChainActions.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,11 @@ const BeaconChainActions: React.FC = () => {
118118
<Translation id="consensus-explore" />
119119
</H3>
120120

121-
<CardList content={datapoints} />
121+
<CardList items={datapoints} />
122122
<H3>
123123
<Translation id="read-more" />
124124
</H3>
125-
<CardList content={reads} />
125+
<CardList items={reads} />
126126
</Box>
127127
)
128128
}

src/components/CardList.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export type CardListItem = {
2626
}
2727

2828
export interface IProps extends BoxProps {
29-
content: Array<CardListItem>
29+
items: Array<CardListItem>
3030
clickHandler?: (idx: string | number) => void
3131
}
3232

@@ -92,12 +92,12 @@ const Card = (props: CardListItem & Omit<StackProps, "title" | "id">) => {
9292
}
9393

9494
const CardList: React.FC<IProps> = ({
95-
content,
95+
items,
9696
clickHandler = () => null,
9797
...rest
9898
}) => (
9999
<Box bg="background.base" w="full" {...rest}>
100-
{content.map((listItem, idx) => {
100+
{items.map((listItem, idx) => {
101101
const { link, id } = listItem
102102
const isLink = !!link
103103

src/components/Codeblock.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ export interface IProps {
204204
allowCollapse?: boolean
205205
codeLanguage: string
206206
fromHomepage?: boolean
207-
children: React.ReactChild
207+
children: React.ReactNode
208208
}
209209

210210
const Codeblock: React.FC<IProps> = ({
@@ -215,13 +215,16 @@ const Codeblock: React.FC<IProps> = ({
215215
}) => {
216216
const selectedTheme = useColorModeValue(codeTheme.light, codeTheme.dark)
217217

218-
const codeText = React.Children.map(children, (child) => {
219-
return getValidChildrenForCodeblock(child)
220-
}).join("")
218+
const codeText = React.Children.toArray(children)
219+
.map((child) => {
220+
if (!child) return
221+
return getValidChildrenForCodeblock(child)
222+
})
223+
.join("")
221224

222225
const [isCollapsed, setIsCollapsed] = useState(allowCollapse)
223226

224-
let className
227+
let className: string
225228
if (React.isValidElement(children)) {
226229
className = children?.props?.className
227230
} else {

src/components/EnergyConsumptionChart.tsx

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
import React from "react"
2-
import { Box, Center, useBreakpointValue, useToken } from "@chakra-ui/react"
2+
import {
3+
Box,
4+
Center,
5+
chakra,
6+
useBreakpointValue,
7+
useToken,
8+
} from "@chakra-ui/react"
39
import {
410
BarChart,
511
Bar,
612
Cell,
13+
Text,
714
XAxis,
815
LabelList,
916
ResponsiveContainer,
@@ -12,7 +19,6 @@ import {
1219
import { useTranslation } from "gatsby-plugin-react-i18next"
1320

1421
import Translation from "./Translation"
15-
import Text from "./OldText"
1622

1723
interface ITickProps {
1824
x: number
@@ -26,23 +32,43 @@ type Data = Array<{
2632
color: string
2733
}>
2834

29-
const CustomTick: React.FC<ITickProps> = ({ x, y, payload }) => {
30-
const textColor = useToken("colors", "text")
35+
const RechartText = chakra(Text, {
36+
shouldForwardProp: (prop) => {
37+
const isValidRechartProp = [
38+
"width",
39+
"children",
40+
"x",
41+
"y",
42+
"dy",
43+
"angle",
44+
"scaleToFit",
45+
"textAnchor",
46+
"verticalAnchor",
47+
"breakAll",
48+
"maxLines",
49+
].includes(prop)
3150

51+
if (isValidRechartProp) return true
52+
53+
return false
54+
},
55+
})
56+
57+
const CustomTick: React.FC<ITickProps> = ({ x, y, payload }) => {
3258
return (
3359
<g transform={`translate(${x},${y})`}>
34-
<Text
60+
<RechartText
3561
x={0}
3662
y={0}
3763
dy={15}
64+
fill="text"
3865
width={50}
39-
fill={textColor}
4066
textAnchor="middle"
4167
verticalAnchor="middle"
42-
fontSize="10px"
68+
fontSize="2xs"
4369
>
4470
{payload.value}
45-
</Text>
71+
</RechartText>
4672
</g>
4773
)
4874
}
@@ -175,8 +201,7 @@ const EnergyConsumptionChart: React.FC = () => {
175201
dataKey="name"
176202
tickLine={false}
177203
axisLine={false}
178-
// @ts-ignore
179-
tick={<CustomTick />}
204+
tick={(props) => <CustomTick {...props} />}
180205
interval={0}
181206
/>
182207
<Legend

src/components/EthExchanges/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ const EthExchanges = () => {
144144
<Text>
145145
<Translation id="page-get-eth-exchanges-success-exchange" />
146146
</Text>
147-
<CardList content={filteredExchanges} />
147+
<CardList items={filteredExchanges} />
148148
</SuccessContainer>
149149
)}
150150
{!hasExchangeResults && (

src/components/FileContributorsCrowdin.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ interface Data {
1818
contributors: Contributor[]
1919
}
2020

21-
interface LangContributor {
21+
export interface LangContributor {
2222
lang: string
2323
data: Data[]
2424
}

src/components/MergeArticleList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const MergeArticleList: React.FC<IProps> = () => {
5353

5454
return (
5555
<Box mb="4rem">
56-
<CardList content={reads} />
56+
<CardList items={reads} />
5757
</Box>
5858
)
5959
}

src/components/Quiz/QuizWidget.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ import questionBank from "../../data/quizzes/questionBank"
6060

6161
interface IProps {
6262
quizKey?: string
63-
currentHandler: (next?: string) => void
64-
statusHandler: (status: QuizStatus) => void
63+
currentHandler?: (next?: string) => void
64+
statusHandler?: (status: QuizStatus) => void
6565
maxQuestions?: number
6666
isStandaloneQuiz?: boolean
6767
}
@@ -112,7 +112,7 @@ const QuizWidget: React.FC<IProps> = ({
112112
setSelectedAnswer(null)
113113

114114
if (!isStandaloneQuiz) {
115-
statusHandler("neutral")
115+
statusHandler?.("neutral")
116116
}
117117

118118
const currentQuizKey =
@@ -220,11 +220,11 @@ const QuizWidget: React.FC<IProps> = ({
220220

221221
if (!isStandaloneQuiz) {
222222
if (currentQuestionAnswerChoice?.isCorrect) {
223-
statusHandler("success")
223+
statusHandler?.("success")
224224
}
225225

226226
if (!currentQuestionAnswerChoice?.isCorrect) {
227-
statusHandler("error")
227+
statusHandler?.("error")
228228
}
229229
}
230230
}
@@ -241,7 +241,7 @@ const QuizWidget: React.FC<IProps> = ({
241241
setShowAnswer(false)
242242

243243
if (!isStandaloneQuiz) {
244-
statusHandler("neutral")
244+
statusHandler?.("neutral")
245245
}
246246
}
247247

@@ -274,7 +274,7 @@ const QuizWidget: React.FC<IProps> = ({
274274

275275
// Reset quiz status (modifies bg color for mobile)
276276
if (!isStandaloneQuiz) {
277-
statusHandler("neutral")
277+
statusHandler?.("neutral")
278278
}
279279

280280
if (finishedQuiz) {
@@ -288,7 +288,7 @@ const QuizWidget: React.FC<IProps> = ({
288288
}
289289

290290
const handleNextQuiz = () => {
291-
currentHandler(nextQuiz)
291+
currentHandler?.(nextQuiz)
292292
}
293293

294294
const AnswerIcon = () => {

src/components/ShardChainsList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const ShardChainsList: React.FC<IProps> = () => {
5353

5454
return (
5555
<Box mb="4rem">
56-
<CardList content={reads} />
56+
<CardList items={reads} />
5757
</Box>
5858
)
5959
}

0 commit comments

Comments
 (0)