Skip to content

Commit 583cf01

Browse files
committed
Merge branch 'dev' into Shadcn_Migrate_Leaderboard.tsx
2 parents 129453c + 1255d9e commit 583cf01

File tree

12 files changed

+320
-616
lines changed

12 files changed

+320
-616
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/IssuesList/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import Emoji from "react-emoji-render"
22
import {
3-
Avatar,
43
Flex,
54
HStack,
65
SimpleGrid,
@@ -13,6 +12,7 @@ import type { GHIssue } from "@/lib/types"
1312

1413
import InlineLink from "../Link"
1514
import Tag from "../Tag"
15+
import { Avatar } from "../ui/avatar"
1616

1717
type IssuesListProps = SimpleGridProps & {
1818
issues: GHIssue[]
@@ -35,8 +35,8 @@ const IssuesList = ({ issues, ...props }: IssuesListProps) => {
3535
<Avatar
3636
name={issue.user.login}
3737
src={issue.user.avatar_url}
38-
w="32px"
39-
h="32px"
38+
size="sm"
39+
href={`https://github.com/${issue.user.login}`}
4040
/>
4141
<Text size="sm">by {issue.user.login}</Text>
4242
</HStack>

src/components/Leaderboard.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,12 @@ const Leaderboard = ({ content, limit = 100 }: LeaderboardProps) => {
5757
>
5858
<div className="me-4 opacity-40">{idx + 1}</div>
5959
<Avatar
60-
className="me-4 flex h-10 w-10 flex-wrap sm:block"
61-
href={avatarImg}
6260
src={avatarImg}
6361
name={avatarAlt}
62+
// This meets the Design System requirement, despite the leaderboard item itself being a link
63+
href={hasGitHub ? `${GITHUB_URL}${username}` : "#"}
64+
// `size-10` is not part of a "size" variant
65+
className="me-4 size-10"
6466
/>
6567
<Flex className="me-8 flex-1 basis-3/4 flex-col">
6668
<LinkOverlay

src/components/Roadmap/RoadmapActionCard/index.tsx

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
1-
import {
2-
Center,
3-
Flex,
4-
Heading,
5-
LinkBox,
6-
LinkOverlay,
7-
Text,
8-
} from "@chakra-ui/react"
9-
101
import { ButtonLink } from "@/components/Buttons"
11-
import { Image } from "@/components/Image"
2+
import { TwImage } from "@/components/Image"
3+
import { Center, Flex } from "@/components/ui/flex"
4+
import { LinkBox } from "@/components/ui/link-box"
5+
import { LinkOverlay } from "@/components/ui/link-box"
126

137
import futureProofing from "@/public/images/roadmap/roadmap-future.png"
148
import security from "@/public/images/roadmap/roadmap-security.png"
@@ -41,22 +35,15 @@ const RoadmapActionCard = ({
4135
const imgSrc = images[image] ?? images.futureProofing
4236

4337
return (
44-
<LinkBox
45-
as={Flex}
46-
direction="column"
47-
border="1px solid"
48-
borderColor="lightBorder"
49-
>
50-
<Center background="cardGradient" h="260px">
51-
<Image src={imgSrc} alt={alt} style={{ objectFit: "contain" }} />
38+
<LinkBox className="flex flex-col border">
39+
<Center className="h-[260px] bg-gradient-main">
40+
<TwImage src={imgSrc} alt={alt} style={{ objectFit: "contain" }} />
5241
</Center>
53-
<Flex p={6} flex="1" flexDir="column" justify="space-between" gap={4}>
54-
<Heading as="h3" size="md">
55-
{title}
56-
</Heading>
57-
<Text flex="1">{description}</Text>
58-
<LinkOverlay as={ButtonLink} href={href}>
59-
{buttonText}
42+
<Flex className="flex-1 flex-col justify-between gap-4 p-6">
43+
<h3 className="text-2xl">{title}</h3>
44+
<p className="flex-1">{description}</p>
45+
<LinkOverlay asChild>
46+
<ButtonLink href={href}>{buttonText}</ButtonLink>
6047
</LinkOverlay>
6148
</Flex>
6249
</LinkBox>

src/components/ui/avatar.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import { LinkBox, LinkOverlay } from "./link-box"
1212
const avatarStyles = tv({
1313
slots: {
1414
container:
15-
"relative shrink-0 flex overflow-hidden rounded-full focus:outline-4 focus:-outline-offset-1 focus:rounded-full active:shadow-none [&_img]:hover:opacity-70 border border-transparent active:border-primary-hover justify-center items-center",
16-
fallback: "bg-body text-body-inverse",
15+
"relative shrink-0 overflow-hidden rounded-full focus:outline-4 focus:-outline-offset-1 focus:rounded-full active:shadow-none [&_img]:hover:opacity-70 border border-transparent active:border-primary-hover ",
16+
fallback: "bg-body text-body-inverse flex justify-center items-center",
1717
},
1818
variants: {
1919
size: {
@@ -126,7 +126,7 @@ const Avatar = React.forwardRef<
126126
href,
127127
src,
128128
name,
129-
size,
129+
size = "md",
130130
label,
131131
className,
132132
direction = "row",

0 commit comments

Comments
 (0)