1
1
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"
3
+ import { useColorModeValue } from "@chakra-ui/react"
13
4
14
- import { Image } from "@/components/Image"
15
- import { BaseLink } from "@/components/Link"
16
- import Text from "@/components/OldText "
5
+ import { TwImage } from "@/components/Image"
6
+ import InlineLink from "@/components/ui /Link"
7
+ import { LinkBox , LinkOverlay } from "@/components/ui/link-box "
17
8
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
- }
29
-
30
- export type ActionCardProps = Omit < LinkBoxProps , "title" > & {
9
+ import { Flex } from "./ui/flex"
10
+ export type ActionCardProps = Omit <
11
+ BaseHTMLAttributes < HTMLDivElement > ,
12
+ "title"
13
+ > & {
14
+ as ?: ElementType
31
15
children ?: ReactNode
32
16
href : string
33
17
alt ?: string
@@ -53,64 +37,41 @@ const ActionCard = ({
53
37
isBottom = true ,
54
38
...props
55
39
} : ActionCardProps ) => {
56
- const descriptionColor = useColorModeValue ( "blackAlpha.700" , "whiteAlpha.800" )
40
+ const descriptionColor = useColorModeValue (
41
+ "text-black opacity-65" ,
42
+ "text-white opacity-80"
43
+ )
57
44
58
45
return (
59
46
< 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 }
47
+ className = { `focus:bg-table-bg-hover m-4 flex flex-none 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 ${ className } ` }
69
48
{ ...props }
70
49
>
71
50
< 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)"
51
+ className = { `action-card-image-wrapper flex h-[260px] flex-row bg-gradient-to-r from-accent-a/10 to-accent-c/10 ${ isBottom ? "items-end" : "items-center" } ${ isRight ? "justify-end" : "justify-center" } shadow-[inset_0px_-1px_0px_rgba(0,0,0,0.1)]` }
79
52
>
80
- < Image
53
+ < TwImage
81
54
src = { image }
82
- width = { imageWidth }
83
- maxH = "full"
84
55
alt = { alt || "" }
85
- style = { { objectFit : "cover" } }
56
+ className = "max-h-full object-cover"
57
+ style = { { width : `${ imageWidth } px` } }
86
58
/>
87
59
</ 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 }
60
+ < div className = "action-card-content p-6" >
61
+ < h3 className = "mb-4 mt-2 text-2xl font-semibold leading-snug" >
62
+ < LinkOverlay asChild >
63
+ < InlineLink
64
+ href = { href }
65
+ hideArrow
66
+ className = "text-body no-underline hover:no-underline focus:no-underline"
67
+ >
68
+ { title }
69
+ </ InlineLink >
107
70
</ LinkOverlay >
108
- </ Heading >
109
- < Text mb = { 0 } color = { descriptionColor } >
110
- { description }
111
- </ Text >
112
- { children && < Box mt = { 8 } > { children } </ Box > }
113
- </ Box >
71
+ </ h3 >
72
+ < p className = { `mb-0 ${ descriptionColor } ` } > { description } </ p >
73
+ { children && < div className = "mt-8" > { children } </ div > }
74
+ </ div >
114
75
</ LinkBox >
115
76
)
116
77
}
0 commit comments