Skip to content

Commit 2ebbd51

Browse files
committed
Merge branch 'dev' into TranslationLeaderboard
2 parents bb4d287 + eda686f commit 2ebbd51

34 files changed

+782
-964
lines changed

src/components/ActionCard.tsx

Lines changed: 37 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,18 @@
11
import { StaticImageData } from "next/image"
2-
import type { ReactNode } from "react"
3-
import {
4-
Box,
5-
type BoxProps,
6-
Flex,
7-
Heading,
8-
LinkBox,
9-
type LinkBoxProps,
10-
LinkOverlay,
11-
useColorModeValue,
12-
} from "@chakra-ui/react"
2+
import type { BaseHTMLAttributes, ElementType, ReactNode } from "react"
133

14-
import { Image } from "@/components/Image"
15-
import { BaseLink } from "@/components/Link"
16-
import Text from "@/components/OldText"
4+
import { TwImage } from "@/components/Image"
5+
import InlineLink from "@/components/ui/Link"
6+
import { LinkBox, LinkOverlay } from "@/components/ui/link-box"
177

18-
const linkBoxFocusStyles: BoxProps = {
19-
borderRadius: "base",
20-
boxShadow: "0px 8px 17px rgba(0, 0, 0, 0.15)",
21-
bg: "tableBackgroundHover",
22-
transition: "transform 0.1s",
23-
transform: "scale(1.02)",
24-
}
25-
26-
const linkFocusStyles: BoxProps = {
27-
textDecoration: "none",
28-
}
8+
import { cn } from "@/lib/utils/cn"
299

30-
export type ActionCardProps = Omit<LinkBoxProps, "title"> & {
10+
import { Flex } from "./ui/flex"
11+
export type ActionCardProps = Omit<
12+
BaseHTMLAttributes<HTMLDivElement>,
13+
"title"
14+
> & {
15+
as?: ElementType
3116
children?: ReactNode
3217
href: string
3318
alt?: string
@@ -53,64 +38,43 @@ const ActionCard = ({
5338
isBottom = true,
5439
...props
5540
}: ActionCardProps) => {
56-
const descriptionColor = useColorModeValue("blackAlpha.700", "whiteAlpha.800")
57-
5841
return (
5942
<LinkBox
60-
boxShadow="
61-
0px 14px 66px rgba(0, 0, 0, 0.07),
62-
0px 10px 17px rgba(0, 0, 0, 0.03), 0px 4px 7px rgba(0, 0, 0, 0.05)"
63-
color="text"
64-
flex="1 1 372px"
65-
_hover={linkBoxFocusStyles}
66-
_focus={linkBoxFocusStyles}
67-
className={className}
68-
m={4}
43+
className={cn(
44+
"flex shadow-table hover:scale-[1.02] hover:rounded hover:bg-background-highlight hover:shadow-table-box-hover hover:duration-100 focus:scale-[1.02] focus:rounded focus:shadow-table-box-hover focus:duration-100",
45+
className
46+
)}
6947
{...props}
7048
>
7149
<Flex
72-
h="260px"
73-
bg="cardGradient"
74-
direction="row"
75-
justify={isRight ? "flex-end" : "center"}
76-
align={isBottom ? "flex-end" : "center"}
77-
className="action-card-image-wrapper"
78-
boxShadow="inset 0px -1px 0px rgba(0, 0, 0, 0.1)"
50+
className={cn(
51+
"flex h-[260px] flex-row bg-gradient-to-r from-accent-a/10 to-accent-c/10",
52+
isBottom ? "items-end" : "items-center",
53+
isRight ? "justify-end" : "justify-center"
54+
)}
7955
>
80-
<Image
56+
<TwImage
8157
src={image}
82-
width={imageWidth}
83-
maxH="full"
8458
alt={alt || ""}
85-
style={{ objectFit: "cover" }}
59+
width={imageWidth}
60+
className="max-h-full object-cover p-4"
8661
/>
8762
</Flex>
88-
<Box p={6} className="action-card-content">
89-
<Heading
90-
as="h3"
91-
fontSize="2xl"
92-
mt={2}
93-
mb={4}
94-
fontWeight={600}
95-
lineHeight={1.4}
96-
>
97-
<LinkOverlay
98-
as={BaseLink}
99-
color="text"
100-
hideArrow
101-
textDecoration="none"
102-
href={href}
103-
_hover={linkFocusStyles}
104-
_focus={linkFocusStyles}
105-
>
106-
{title}
63+
<div className="flex flex-col justify-center p-6">
64+
<h3 className="mb-4 mt-2 text-2xl font-semibold leading-snug">
65+
<LinkOverlay asChild>
66+
<InlineLink
67+
href={href}
68+
hideArrow
69+
className="text-body no-underline"
70+
>
71+
{title}
72+
</InlineLink>
10773
</LinkOverlay>
108-
</Heading>
109-
<Text mb={0} color={descriptionColor}>
110-
{description}
111-
</Text>
112-
{children && <Box mt={8}>{children}</Box>}
113-
</Box>
74+
</h3>
75+
<p className={"mb-0 text-body/65"}>{description}</p>
76+
{children && <div className="mt-8">{children}</div>}
77+
</div>
11478
</LinkBox>
11579
)
11680
}

src/components/FileContributors.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@ import type { ChildOnlyProp, FileContributor } from "@/lib/types"
1212

1313
import { Button } from "@/components/Buttons"
1414
import InlineLink from "@/components/Link"
15-
import Modal from "@/components/Modal"
1615
import Text from "@/components/OldText"
1716
import Translation from "@/components/Translation"
1817

1918
import { trackCustomEvent } from "@/lib/utils/matomo"
2019

20+
import Modal from "./ui/dialog-modal"
21+
22+
import { useBreakpointValue } from "@/hooks/useBreakpointValue"
23+
2124
const ContributorList = ({ children }: Required<ChildOnlyProp>) => (
2225
<UnorderedList maxH="2xs" m={0} mt={6} overflowY="scroll">
2326
{children}
@@ -61,12 +64,14 @@ const FileContributors = ({
6164
date: Date.now().toString(),
6265
} as FileContributor)
6366

67+
const modalSize = useBreakpointValue({ base: "xl", md: "md" } as const)
68+
6469
return (
6570
<>
6671
<Modal
67-
isOpen={isModalOpen}
68-
onClose={() => setModalOpen(false)}
69-
size={{ base: "full", md: "xl" }}
72+
open={isModalOpen}
73+
onOpenChange={(open) => setModalOpen(open)}
74+
size={modalSize}
7075
title={<Translation id="contributors" />}
7176
>
7277
<Translation id="contributors-thanks" />

src/components/HorizontalCard.tsx

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

43
import { cn } from "@/lib/utils/cn"
54

65
import Emoji from "./Emoji"
7-
import Text from "./OldText"
86

9-
export type HorizontalCardProps = Omit<FlexProps, "title"> & {
7+
export interface HorizontalCardProps
8+
extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
109
emoji: string
10+
emojiClassName?: string
1111
title?: ReactNode
1212
description: ReactNode
13+
children?: ReactNode
1314
}
1415

1516
const HorizontalCard = ({
1617
emoji,
18+
emojiClassName,
1719
title,
1820
description,
1921
children,
2022
className,
21-
...rest
22-
}: HorizontalCardProps) => (
23-
<Flex borderRadius="base" {...rest}>
24-
<Emoji className={cn("text-5xl", className)} text={emoji} />
25-
<Box flexGrow="0" flexShrink="1" flexBasis="75%" ms="8">
26-
<Text fontSize="lg">{title}</Text>
27-
<Text mt="-4" mb="2">
28-
{description}
29-
</Text>
30-
<>{children}</>
31-
</Box>
32-
</Flex>
33-
)
23+
...props
24+
}: HorizontalCardProps) => {
25+
return (
26+
<div className={cn("flex items-center gap-8", className)} {...props}>
27+
<Emoji text={emoji} className={cn("text-5xl", emojiClassName)} />
28+
<div className="flex-shrink flex-grow-0 basis-3/4 space-y-2">
29+
<p className="text-lg">{title}</p>
30+
<p>{description}</p>
31+
{children}
32+
</div>
33+
</div>
34+
)
35+
}
3436

3537
export default HorizontalCard

src/components/Layer2ProductCard.tsx

Lines changed: 66 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
// Libraries
21
import { StaticImageData } from "next/image"
32
import { useTranslation } from "next-i18next"
4-
import { Box, Center, Flex, Heading } from "@chakra-ui/react"
53

6-
import { ButtonLink } from "@/components/Buttons"
7-
import { Image } from "@/components/Image"
8-
import InlineLink from "@/components/Link"
9-
import Text from "@/components/OldText"
4+
import { Card, CardContent, CardFooter, CardHeader } from "@/components/ui/card"
5+
6+
import { ButtonLink } from "./ui/buttons/Button"
7+
import InlineLink from "./ui/Link"
8+
import { TwImage } from "./Image"
109

1110
export type Layer2ProductCardProps = {
1211
children?: React.ReactNode
@@ -38,72 +37,75 @@ const Layer2ProductCard = ({
3837
const { t } = useTranslation("page-layer-2")
3938

4039
return (
41-
<Flex
42-
color="text"
43-
boxShadow={"0px 14px 66px rgba(0, 0, 0, 0.07)"}
44-
direction="column"
45-
justify="space-between"
46-
bg="searchBackground"
47-
borderRadius="base"
48-
border={"1px solid lightBorder"}
49-
textDecoration="none"
50-
padding={2}
51-
_hover={{ transition: "transform 0.1s", transform: "scale(1.02)" }}
52-
>
53-
<Center
54-
bg={background}
55-
boxShadow="inset 0px -1px 0px rgba(0, 0, 0, 0.1)"
56-
minH="200px"
40+
<Card className="flex flex-col justify-between rounded-md border-0 bg-background-highlight p-2 shadow-lg transition-transform duration-100 hover:scale-[1.02]">
41+
<div
42+
className="mb-4 flex min-h-[200px] items-center justify-center border-b"
43+
style={{ backgroundColor: background }}
5744
>
58-
<Image
45+
<TwImage
5946
src={image}
6047
alt={alt}
6148
width={100}
62-
maxH={"257px"}
63-
style={{ objectFit: "contain" }}
49+
className="max-h-[257px] object-cover"
6450
/>
65-
</Center>
66-
<Flex p={6} h="100%" direction="column">
67-
<Box>
68-
<Heading as="h3" fontSize={{ base: "xl", md: "2xl" }} mb={3}>
69-
{name}
70-
</Heading>
71-
{children && (
72-
<Box mt={4} mb={4}>
73-
{children}
74-
</Box>
75-
)}
76-
<Text fontSize="sm" mb={2} lineHeight="140%">
77-
{description}
78-
</Text>
79-
{note.length > 0 && (
80-
<Text fontSize="sm" mb={2} lineHeight="140%">
51+
</div>
52+
53+
<CardHeader className="py-0">
54+
<div className="space-y-4">
55+
<h3 className="mb-3 text-xl font-semibold md:text-2xl">{name}</h3>
56+
{children && <div>{children}</div>}
57+
</div>
58+
</CardHeader>
59+
60+
<CardContent className="flex flex-grow flex-col gap-0 space-y-1 px-6 py-4">
61+
<div className="space-y-2">
62+
<p className="text-sm leading-snug">{description}</p>
63+
64+
{note && (
65+
<p className="text-sm leading-snug">
8166
{t("layer-2-note")} {note}
82-
</Text>
67+
</p>
8368
)}
84-
</Box>
85-
{bridge && (
86-
<InlineLink href={bridge}>
87-
{name} {t("layer-2-bridge")}
88-
</InlineLink>
89-
)}
90-
{ecosystemPortal && (
91-
<InlineLink href={ecosystemPortal}>
92-
{name} {t("layer-2-ecosystem-portal")}
93-
</InlineLink>
94-
)}
95-
{tokenLists && (
96-
<InlineLink href={tokenLists}>
97-
{name} {t("layer-2-token-lists")}
98-
</InlineLink>
69+
</div>
70+
71+
<div className="space-y-1">
72+
{bridge && (
73+
<InlineLink
74+
href={bridge}
75+
className="block text-primary underline hover:text-primary/80"
76+
>
77+
{name} {t("layer-2-bridge")}
78+
</InlineLink>
79+
)}
80+
81+
{ecosystemPortal && (
82+
<InlineLink
83+
href={ecosystemPortal}
84+
className="block text-primary underline hover:text-primary/80"
85+
>
86+
{name} {t("layer-2-ecosystem-portal")}
87+
</InlineLink>
88+
)}
89+
90+
{tokenLists && (
91+
<InlineLink
92+
href={tokenLists}
93+
className="block text-primary underline hover:text-primary/80"
94+
>
95+
{name} {t("layer-2-token-lists")}
96+
</InlineLink>
97+
)}
98+
</div>
99+
</CardContent>
100+
101+
<CardFooter className="mt-2 p-2">
102+
{url && (
103+
<ButtonLink className="w-full" href={url}>
104+
{t("layer-2-explore")} {name}
105+
</ButtonLink>
99106
)}
100-
</Flex>
101-
<Box>
102-
<ButtonLink m={2} href={url} display="flex">
103-
{t("layer-2-explore")} {name}
104-
</ButtonLink>
105-
</Box>
106-
</Flex>
107+
</CardFooter>
108+
</Card>
107109
)
108110
}
109111

0 commit comments

Comments
 (0)