Skip to content

Commit 0e518b8

Browse files
committed
Merge branch 'dev' into tag-migration
2 parents 57cb8e1 + 50662eb commit 0e518b8

File tree

16 files changed

+399
-762
lines changed

16 files changed

+399
-762
lines changed

src/components/BoxGrid.tsx

Lines changed: 24 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import React, { useState } from "react"
2-
import { Box, Flex, GridItem, SimpleGrid } from "@chakra-ui/react"
32

43
import { cn } from "@/lib/utils/cn"
54
import { MatomoEventOptions, trackCustomEvent } from "@/lib/utils/matomo"
65

6+
import { Flex } from "./ui/flex"
77
import Emoji from "./Emoji"
8-
import OldHeading from "./OldHeading"
9-
import Text from "./OldText"
108

119
export interface BoxItem {
1210
emoji: string
@@ -32,54 +30,33 @@ const hashCode = (stringPhrase: string): number => {
3230

3331
// Theme variables from Theme.js
3432
const colors = [
35-
"gridYellow",
36-
"gridRed",
37-
"gridBlue",
38-
"gridGreen",
39-
"warning",
40-
"gridPink",
41-
"gridPurple",
33+
"bg-[#ffe78e]",
34+
"bg-[#ef7d7d]",
35+
"bg-[#a7d0f4]",
36+
"bg-[#6fc4a0]",
37+
"bg-[#ffe3d3]",
38+
"bg-[#ffa1c3]",
39+
"bg-[#a4a4ff]",
4240
]
4341

4442
const BoxGrid = ({ items }: BoxGridProps) => {
4543
const [indexOpen, setOpenIndex] = useState(0)
4644

4745
return (
48-
<SimpleGrid columns={{ base: 1, lg: 4 }} my={16} borderRadius="sm">
46+
<div className="my-16 grid grid-cols-1 rounded-sm lg:grid-cols-4">
4947
{items.map((item, idx: number) => {
50-
let columnNumber = idx + 1
51-
if (columnNumber > 4) {
52-
columnNumber = columnNumber - 3
53-
}
5448
const colorIdx = hashCode(item.emoji) % colors.length
5549
const color = colors[colorIdx]
5650
const isOpen = idx === indexOpen
5751

5852
return (
59-
<GridItem
60-
as={Flex}
61-
rowStart={{ ...(isOpen && { lg: 1 }) }}
62-
rowEnd={{ ...(isOpen && { lg: 3 }) }}
63-
colStart={{ ...(isOpen && { lg: columnNumber }) }}
64-
color={isOpen ? "black300" : "text"}
65-
cursor="pointer"
66-
bg={isOpen ? color : "background.base"}
67-
direction={{
68-
base: isOpen ? "column" : "column-reverse",
69-
sm: isOpen ? "column" : "row-reverse",
70-
lg: isOpen ? "column" : "column-reverse",
71-
}}
72-
align={{ base: "center", lg: "stretch" }}
73-
justify="space-between"
74-
border="1px solid"
75-
borderColor="text"
76-
p={6}
77-
_hover={{
78-
bg: isOpen ? color : "ednBackground",
79-
transition: "transform 0.5s",
80-
transform: "skewX(-5deg)",
81-
boxShadow: "tableBoxShadow",
82-
}}
53+
<Flex
54+
className={cn(
55+
"cursor-pointer items-center justify-between border border-body p-6 transition-transform duration-500 hover:-skew-x-6 hover:shadow-table-box-hover lg:items-stretch",
56+
isOpen
57+
? `flex-col text-gray-600 sm:flex-col lg:row-start-1 lg:row-end-3 lg:flex-col ${color}`
58+
: "flex-col-reverse bg-background text-body hover:bg-background-highlight sm:flex-row-reverse lg:flex-col-reverse"
59+
)}
8360
onClick={() => {
8461
setOpenIndex(idx)
8562
trackCustomEvent({
@@ -99,26 +76,20 @@ const BoxGrid = ({ items }: BoxGridProps) => {
9976
)}
10077
text={item.emoji}
10178
/>
102-
<Box>
103-
<OldHeading
104-
as="h3"
105-
fontSize="2.5rem"
106-
fontWeight="normal"
107-
mt={0}
108-
lineHeight={1.4}
109-
>
79+
<div>
80+
<h3 className="mb-8 mt-0 text-[2.5rem] font-normal leading-xs">
11081
{item.title}
111-
</OldHeading>
82+
</h3>
11283
{isOpen && (
113-
<Text fontSize="xl" lineHeight={1.4} color="black300">
84+
<p className="mb-6 text-xl leading-xs text-gray-600">
11485
{item.description}
115-
</Text>
86+
</p>
11687
)}
117-
</Box>
118-
</GridItem>
88+
</div>
89+
</Flex>
11990
)
12091
})}
121-
</SimpleGrid>
92+
</div>
12293
)
12394
}
12495

src/components/CallToContribute/index.tsx

Lines changed: 14 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,36 @@
1-
import React, { ReactNode } from "react"
1+
import React from "react"
22
import { FaGithub } from "react-icons/fa"
3-
import { Flex, FlexProps, Icon } from "@chakra-ui/react"
43

54
import { ChildOnlyProp } from "@/lib/types"
65

7-
import { ButtonLink } from "@/components/Buttons"
8-
import InlineLink from "@/components/Link"
9-
import OldHeading from "@/components/OldHeading"
10-
import Text from "@/components/OldText"
116
import Translation from "@/components/Translation"
127

8+
import { ButtonLink } from "../ui/buttons/Button"
9+
import { Flex } from "../ui/flex"
10+
import InlineLink from "../ui/Link"
11+
1312
export type CallToContributeProps = {
1413
editPath: string
1514
}
1615

17-
const ContentColumn = (props: {
18-
children: ReactNode
19-
hideBelow?: FlexProps["hideBelow"]
20-
}) => (
16+
const ContentColumn = (props: ChildOnlyProp) => (
2117
<Flex
22-
direction="column"
23-
flexGrow={1}
24-
flexShrink={1}
25-
flexBasis="50%"
26-
p={4}
27-
color="text"
28-
textAlign={{ base: "center", lg: "start" }}
18+
className="flex-1 basis-1/2 flex-col p-4 text-body lg:text-start"
2919
{...props}
3020
/>
3121
)
3222

3323
const DescriptionParagraph = ({ children }: ChildOnlyProp) => (
34-
<Text lineHeight="140%" color="text" fontFamily="monospace">
35-
{children}
36-
</Text>
24+
<p className="mb-6 font-monospace leading-xs text-body">{children}</p>
3725
)
3826

3927
const CallToContribute = ({ editPath }: CallToContributeProps) => {
4028
return (
41-
<Flex
42-
as="aside"
43-
bg="ednBackground"
44-
align="center"
45-
mt={8}
46-
border="1px"
47-
borderColor="primary.base"
48-
borderRadius="base"
49-
boxShadow="inset 0 -2px 0 0 var(--eth-colors-primary400)"
50-
>
29+
<aside className="mt-8 items-center rounded-md border border-b-4 border-primary bg-background-highlight">
5130
<ContentColumn>
52-
<OldHeading
53-
as="h2"
54-
fontFamily="monospace"
55-
textTransform="uppercase"
56-
p={1}
57-
fontSize="2rem"
58-
lineHeight={1.4}
59-
mt={0}
60-
>
31+
<h2 className="mb-8 mt-0 p-1 font-monospace uppercase leading-xs">
6132
<Translation id="page-developers-docs:page-calltocontribute-title" />
62-
</OldHeading>
33+
</h2>
6334
<DescriptionParagraph>
6435
<Translation id="page-developers-docs:page-calltocontribute-desc-1" />
6536
</DescriptionParagraph>
@@ -78,22 +49,12 @@ const CallToContribute = ({ editPath }: CallToContributeProps) => {
7849
<Translation id="page-developers-docs:page-calltocontribute-link-2" />
7950
</InlineLink>{" "}
8051
</DescriptionParagraph>
81-
<ButtonLink
82-
href={editPath}
83-
leftIcon={
84-
<Icon
85-
fill="background.base"
86-
w={6}
87-
h={6}
88-
as={FaGithub}
89-
name="github"
90-
/>
91-
}
92-
>
52+
<ButtonLink href={editPath}>
53+
<FaGithub className="h-6 w-6" />
9354
<Translation id="page-developers-docs:page-calltocontribute-span" />
9455
</ButtonLink>
9556
</ContentColumn>
96-
</Flex>
57+
</aside>
9758
)
9859
}
9960

src/components/FileContributors.tsx

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { BaseHTMLAttributes, useState } from "react"
2-
import { Avatar } from "@chakra-ui/react"
32

43
import type { ChildOnlyProp, FileContributor } from "@/lib/types"
54

@@ -12,6 +11,7 @@ import { ScrollArea } from "@/components/ui/scroll-area"
1211

1312
import { trackCustomEvent } from "@/lib/utils/matomo"
1413

14+
import { Avatar } from "./ui/avatar"
1515
import Modal from "./ui/dialog-modal"
1616

1717
import { useBreakpointValue } from "@/hooks/useBreakpointValue"
@@ -22,19 +22,27 @@ const ContributorList = ({ children }: Required<ChildOnlyProp>) => (
2222
</ScrollArea>
2323
)
2424

25+
const ContributorAvatar = ({
26+
contributor,
27+
label,
28+
}: ContributorProps & { label?: string }) => (
29+
<Avatar
30+
src={contributor.avatar_url}
31+
name={contributor.login}
32+
href={`https://github.com/${contributor.login}`}
33+
// `size-10` is not part of the "size" variants
34+
className="me-2 size-10"
35+
label={label}
36+
/>
37+
)
38+
2539
type ContributorProps = { contributor: FileContributor }
2640
const Contributor = ({ contributor }: ContributorProps) => (
2741
<ListItem className="flex items-center p-2">
28-
<Avatar
29-
height="40px"
30-
width="40px"
31-
src={contributor.avatar_url}
32-
name={contributor.login}
33-
me={2}
42+
<ContributorAvatar
43+
contributor={contributor}
44+
label={"@" + contributor.login}
3445
/>
35-
<InlineLink href={"https://github.com/" + contributor.login}>
36-
@{contributor.login}
37-
</InlineLink>
3846
</ListItem>
3947
)
4048

@@ -84,13 +92,7 @@ const FileContributors = ({
8492

8593
<Flex className="flex-col p-0 md:flex-row md:p-2" {...props}>
8694
<Flex className="invisible me-4 flex-1 items-center md:visible md:flex">
87-
<Avatar
88-
height="40px"
89-
width="40px"
90-
src={lastContributor.avatar_url}
91-
name={lastContributor.login}
92-
me={2}
93-
/>
95+
<ContributorAvatar contributor={lastContributor} />
9496

9597
<p className="m-0 text-body-medium">
9698
<Translation id="last-edit" />:{" "}

src/components/InfoBanner.tsx

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
import type { ReactNode } from "react"
2-
import { Flex, type FlexProps, LightMode } from "@chakra-ui/react"
32

43
import Emoji from "@/components/Emoji"
5-
import Text from "@/components/OldText"
64

7-
type InfoBannerProps = FlexProps & {
5+
import { cn } from "@/lib/utils/cn"
6+
7+
import { Flex, VStack } from "./ui/flex"
8+
9+
type InfoBannerProps = {
810
children?: ReactNode
911
emoji?: string
1012
isWarning?: boolean
1113
shouldCenter?: boolean
1214
shouldSpaceBetween?: boolean
1315
title?: string
16+
id?: string
17+
className?: string
1418
}
1519

1620
const InfoBanner = ({
@@ -20,47 +24,45 @@ const InfoBanner = ({
2024
shouldCenter,
2125
shouldSpaceBetween,
2226
title,
27+
className,
2328
...props
2429
}: InfoBannerProps) => {
2530
const banner = (
26-
<LightMode>
31+
<VStack
32+
className={cn(
33+
"rounded-sm p-6 sm:flex-row",
34+
shouldCenter ? "max-w-[55rem]" : "max-w-full",
35+
isWarning
36+
? "bg-warning-light dark:text-body-inverse"
37+
: "bg-primary-low-contrast",
38+
className
39+
)}
40+
{...props}
41+
>
42+
{emoji && (
43+
<Emoji
44+
className="mb-2 me-0 flex-shrink-0 flex-grow-0 self-start text-4xl sm:mb-0 sm:me-6 sm:self-auto"
45+
text={emoji}
46+
/>
47+
)}
2748
<Flex
28-
align="center"
29-
p="6"
30-
borderRadius="sm"
31-
maxW={shouldCenter ? "55rem" : "100%"}
32-
sx={{
33-
":not(button)": {
34-
color: "black300 !important",
35-
},
36-
}}
37-
bg={isWarning ? "warning" : "infoBanner"}
38-
direction={{ base: "column", sm: "row" }}
39-
{...props}
40-
>
41-
{emoji && (
42-
<Emoji
43-
className="mb-2 me-0 flex-shrink-0 flex-grow-0 self-start text-4xl sm:mb-0 sm:me-6 sm:self-auto"
44-
text={emoji}
45-
/>
49+
className={cn(
50+
"block",
51+
shouldSpaceBetween
52+
? "w-full items-center justify-between sm:flex"
53+
: "w-auto sm:block"
4654
)}
47-
<Flex
48-
display={{ base: "block", sm: shouldSpaceBetween ? "flex" : "block" }}
49-
align={shouldSpaceBetween ? "center" : "auto"}
50-
w={shouldSpaceBetween ? "100%" : "auto"}
51-
justify={shouldSpaceBetween ? "space-between" : "auto"}
52-
>
53-
{title && (
54-
<Text fontSize="lg" fontWeight="bold">
55-
{title}
56-
</Text>
57-
)}
58-
{children}
59-
</Flex>
55+
>
56+
{title && <p className="mb-6 text-lg font-bold">{title}</p>}
57+
{children}
6058
</Flex>
61-
</LightMode>
59+
</VStack>
60+
)
61+
return shouldCenter ? (
62+
<Flex className="justify-center">{banner}</Flex>
63+
) : (
64+
banner
6265
)
63-
return shouldCenter ? <Flex justify="center">{banner}</Flex> : banner
6466
}
6567

6668
export default InfoBanner

0 commit comments

Comments
 (0)