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