1
1
import React from "react"
2
2
import { StaticImageData } from "next/image"
3
- import {
4
- Box ,
5
- Flex ,
6
- Heading ,
7
- LinkBox ,
8
- LinkOverlay ,
9
- useColorModeValue ,
10
- } from "@chakra-ui/react"
11
3
12
- import { Image } from "@/components/Image"
4
+ import { TwImage } from "@/components/Image"
5
+ import { Flex } from "@/components/ui/flex"
13
6
14
- import Text from "./OldText"
7
+ import InlineLink from "./ui/Link"
8
+ import { LinkBox , LinkOverlay } from "./ui/link-box"
15
9
16
10
export interface DataRow {
17
11
logo : StaticImageData
@@ -23,7 +17,7 @@ export type DataProductCardProps = {
23
17
url : string
24
18
background : string
25
19
image : StaticImageData
26
- imgWidth : string
20
+ imgWidth : number
27
21
alt ?: string
28
22
name : string
29
23
description ?: string
@@ -40,104 +34,53 @@ const DataProductCard = ({
40
34
description,
41
35
data,
42
36
} : DataProductCardProps ) => {
43
- const boxShadow = useColorModeValue ( "tableBox.light" , "tableBox.dark" )
44
-
45
37
return (
46
- < LinkBox
47
- color = "text"
48
- background = "searchBackground"
49
- border = "1px solid"
50
- borderColor = "lightBorder"
51
- borderRadius = "base"
52
- overflow = "hidden"
53
- boxShadow = { boxShadow }
54
- display = "flex"
55
- flexDirection = "column"
56
- _hover = { {
57
- background : "tableBackgroundHover" ,
58
- boxShadow : boxShadow ,
59
- transition : "transform 0.1s ease 0s" ,
60
- transform : "scale(1.02)" ,
61
- } }
62
- >
38
+ < LinkBox className = "flex flex-col overflow-hidden rounded border shadow-table-box transition-transform duration-100 ease-linear hover:scale-[1.02] hover:bg-background-highlight focus:scale-[1.02] focus:bg-background-highlight" >
63
39
< Flex
64
- alignItems = "center"
65
- justifyContent = "center"
66
- boxShadow = "rgb(0 0 0 / 10%) 0px -1px 0px inset;"
67
- minH = "200px"
68
- bg = { background }
40
+ className = {
41
+ "min-h-[200px] items-center justify-center shadow-[rgb(0_0_0/_10%)_0px_-1px_0px_inset]"
42
+ }
43
+ style = { { background } }
69
44
>
70
- < Image
71
- src = { image }
72
- objectFit = "cover"
45
+ < TwImage
73
46
alt = { alt ? alt : `${ name } logo` }
74
- w = { imgWidth }
75
- alignSelf = "center"
76
- maxWidth = { { base : "311px" , sm : "372px" } }
77
- maxHeight = "257px"
47
+ className = "max-h-[257px] max-w-[311px] self-center object-cover sm:max-w-[372px]"
48
+ src = { image }
49
+ width = { imgWidth }
78
50
/>
79
51
</ Flex >
80
- < Flex
81
- textAlign = "start"
82
- flexDirection = "column"
83
- justifyContent = "space-between"
84
- >
85
- < Box >
86
- < Heading
87
- as = "h3"
88
- size = "lg"
89
- fontSize = "2xl"
90
- fontWeight = "600"
91
- lineHeight = "1.4"
92
- my = { 8 }
93
- mx = { 4 }
94
- mb = { 4 }
95
- >
96
- < LinkOverlay href = { url } isExternal >
97
- { name }
52
+ < Flex className = "flex-col justify-between text-left" >
53
+ < div >
54
+ < h3 className = "mx-4 my-8 mb-4 text-2xl font-semibold" >
55
+ < LinkOverlay asChild >
56
+ < InlineLink href = { url } hideArrow >
57
+ { name }
58
+ </ InlineLink >
98
59
</ LinkOverlay >
99
- </ Heading >
100
- < Text fontSize = "sm" mx = { 4 } mb = { 4 } lineHeight = "140%" >
101
- { description }
102
- </ Text >
103
- </ Box >
60
+ </ h3 >
61
+ < p className = "mx-4 mb-4 text-sm leading-[140%]" > { description } </ p >
62
+ </ div >
104
63
{ data && (
105
- < Box
106
- overflowY = "scroll"
107
- maxHeight = "160px"
108
- mb = { 4 }
109
- borderTop = "1px solid"
110
- borderColor = "lightBorder"
111
- >
64
+ < div className = "mb-4 max-h-[160px] overflow-y-scroll border-t" >
112
65
{ data . map ( ( { logo, coin, apy } , idx ) => (
113
66
< Flex
114
67
key = { idx }
115
- color = "text300"
116
- fontSize = "sm"
117
- justify = "space-between"
118
- p = { 4 }
119
- textTransform = "uppercase"
120
- border = "1px solid"
121
- borderColor = "lightBorder"
122
- borderInlineStart = "0"
123
- borderInlineEnd = "0"
68
+ className = "justify-between border border-x-0 p-4 text-sm uppercase"
124
69
>
125
- < Flex alignItems = " center">
70
+ < Flex className = "items- center">
126
71
{ logo && (
127
- < Image
72
+ < TwImage
73
+ className = "me-2 min-w-6 object-cover"
128
74
src = { logo }
129
- objectFit = "cover"
130
75
alt = ""
131
- minWidth = "24px"
132
- me = { 2 }
133
76
/>
134
77
) }
135
78
{ coin }
136
79
</ Flex >
137
- < Flex alignItems = " center"> { apy } % APY</ Flex >
80
+ < Flex className = "items- center"> { apy } % APY</ Flex >
138
81
</ Flex >
139
82
) ) }
140
- </ Box >
83
+ </ div >
141
84
) }
142
85
</ Flex >
143
86
</ LinkBox >
0 commit comments