1
1
import { useTranslation } from "next-i18next"
2
- import {
3
- Avatar ,
4
- Box ,
5
- Flex ,
6
- LinkBox ,
7
- LinkOverlay ,
8
- List ,
9
- ListItem ,
10
- useColorModeValue ,
11
- VisuallyHidden ,
12
- } from "@chakra-ui/react"
2
+ import { VisuallyHidden } from "@radix-ui/react-visually-hidden"
13
3
14
4
import Emoji from "@/components/Emoji"
15
- import { BaseLink } from "@/components/Link"
16
5
17
6
import { GITHUB_URL } from "@/lib/constants"
18
7
8
+ import { Avatar } from "./ui/avatar"
9
+ import { Flex } from "./ui/flex"
10
+ import { LinkBox } from "./ui/link-box"
11
+ import { LinkOverlay } from "./ui/link-box"
12
+ import { List , ListItem } from "./ui/list"
13
+
19
14
import { useRtlFlip } from "@/hooks/useRtlFlip"
20
15
21
16
type Person = {
@@ -30,29 +25,12 @@ type LeaderboardProps = {
30
25
}
31
26
32
27
const Leaderboard = ( { content, limit = 100 } : LeaderboardProps ) => {
33
- const { flipForRtl } = useRtlFlip ( )
34
- const colorModeStyles = useColorModeValue (
35
- {
36
- listBoxShadow : "tableBox.light" ,
37
- linkBoxShadow : "tableItemBox.light" ,
38
- scoreColor : "blackAlpha.700" ,
39
- } ,
40
- {
41
- listBoxShadow : "tableBox.dark" ,
42
- linkBoxShadow : "tableItemBox.dark" ,
43
- scoreColor : "whiteAlpha.600" ,
44
- }
45
- )
46
-
28
+ const { twFlipForRtl } = useRtlFlip ( )
47
29
const { t } = useTranslation ( "page-bug-bounty" )
48
30
49
31
return (
50
32
< List
51
- bgColor = "background.base"
52
- boxShadow = { colorModeStyles . listBoxShadow }
53
- w = "100%"
54
- mb = { 8 }
55
- ms = { 0 }
33
+ className = "mb-8 ms-0 w-full list-none bg-background shadow-table-box"
56
34
aria-label = { t ( "page-upgrades-bug-bounty-leaderboard-list" ) }
57
35
>
58
36
{ content
@@ -72,41 +50,22 @@ const Leaderboard = ({ content, limit = 100 }: LeaderboardProps) => {
72
50
}
73
51
74
52
return (
75
- < ListItem key = { username } mb = { 0 } >
53
+ < ListItem className = "mb-0" key = { username } >
76
54
< LinkBox
55
+ className = "mb-1 flex w-full items-center justify-between p-4 shadow-table-item-box hover:rounded-lg hover:bg-background-highlight hover:no-underline hover:shadow-primary"
77
56
key = { idx }
78
- display = "flex"
79
- justifyContent = "space-between"
80
- alignItems = "center"
81
- boxShadow = { colorModeStyles . linkBoxShadow }
82
- mb = { 0.25 }
83
- p = { 4 }
84
- w = "100%"
85
- _hover = { {
86
- textDecor : "none" ,
87
- borderRadius : 0.5 ,
88
- boxShadow : "0 0 1px var(--eth-colors-primary-base)" ,
89
- background : "tableBackgroundHover" ,
90
- } }
91
57
>
92
- < Box me = { 4 } opacity = "0.4" >
93
- { idx + 1 }
94
- </ Box >
58
+ < div className = "me-4 opacity-40" > { idx + 1 } </ div >
95
59
< Avatar
60
+ className = "me-4 flex h-10 w-10 flex-wrap sm:block"
61
+ href = { avatarImg }
96
62
src = { avatarImg }
97
63
name = { avatarAlt }
98
- me = { 4 }
99
- h = { 10 }
100
- w = { 10 }
101
- display = { { base : "none" , xs : "block" } }
102
64
/>
103
- < Flex flex = "1 1 75%" direction = "column" me = { 8 } >
65
+ < Flex className = "me-8 flex-1 basis-3/4 flex-col" >
104
66
< LinkOverlay
105
- as = { BaseLink }
67
+ className = "text-body no-underline"
106
68
href = { hasGitHub ? `${ GITHUB_URL } ${ username } ` : "#" }
107
- textDecor = "none"
108
- color = "text"
109
- hideArrow
110
69
>
111
70
< VisuallyHidden > { `In place number ${
112
71
idx + 1
@@ -117,20 +76,13 @@ const Leaderboard = ({ content, limit = 100 }: LeaderboardProps) => {
117
76
) }
118
77
</ LinkOverlay >
119
78
120
- < Box fontSize = "sm" color = { colorModeStyles . scoreColor } >
79
+ < div className = "text-sm text-body-medium" >
121
80
{ score } { t ( "page-upgrades-bug-bounty-leaderboard-points" ) }
122
- </ Box >
81
+ </ div >
123
82
</ Flex >
124
83
{ emoji && < Emoji className = "me-8 text-2xl" text = { emoji } /> }
125
- < Box
126
- as = "span"
127
- _after = { {
128
- content : '"↗"' ,
129
- ms : 0.5 ,
130
- me : 1.5 ,
131
- transform : flipForRtl ,
132
- display : "inline-block" ,
133
- } }
84
+ < span
85
+ className = { `after:me-1.5 after:ms-0.5 after:content-['↗'] after:${ twFlipForRtl } after:inline-block` }
134
86
/>
135
87
</ LinkBox >
136
88
</ ListItem >
0 commit comments