1
1
import { AiOutlineArrowRight } from "react-icons/ai"
2
- import {
3
- Box ,
4
- Flex ,
5
- Icon ,
6
- LinkBox ,
7
- LinkOverlay ,
8
- useToken ,
9
- } from "@chakra-ui/react"
10
2
3
+ import { cn } from "@/lib/utils/cn"
4
+
5
+ import { Center , Flex , Stack } from "./ui/flex"
6
+ import { LinkBox , LinkOverlay } from "./ui/link-box"
11
7
import Emoji from "./Emoji"
12
- import { BaseLink } from "./Link"
13
- import Text from "./OldText"
14
8
15
9
import { useRtlFlip } from "@/hooks/useRtlFlip"
16
10
@@ -21,61 +15,36 @@ export type DocLinkProps = {
21
15
}
22
16
23
17
const DocLink = ( { href, children, isExternal = false } : DocLinkProps ) => {
24
- const linkBoxShadowColor = useToken ( "colors" , "primary.base" )
25
- const { flipForRtl } = useRtlFlip ( )
18
+ const { isRtl } = useRtlFlip ( )
26
19
27
20
return (
28
21
< LinkBox
29
- padding = { 4 }
30
- borderRadius = "sm"
31
- color = "text"
32
- border = "1px"
33
- borderStyle = "solid"
34
- borderColor = "border"
35
- _hover = { {
36
- background : "tableBackgroundHover" ,
37
- borderRadius : "base" ,
38
- boxShadow : `0 0 1px ${ linkBoxShadowColor } ` ,
39
- } }
22
+ className = { cn (
23
+ "flex rounded-sm border p-4 text-current no-underline" ,
24
+ "hover:rounded hover:bg-background-highlight hover:no-underline" ,
25
+ "group hover:shadow-[0_0_1px] hover:shadow-primary"
26
+ ) }
40
27
>
41
- < Flex
42
- zIndex = { 1 }
43
- display = "flex"
44
- flexDirection = "row"
45
- flex = { 1 }
46
- justifyContent = "space-between"
47
- data-group
48
- >
49
- < Flex align = "center" >
28
+ < Flex className = "flex-1 justify-between" >
29
+ < Center >
50
30
< Emoji className = "me-4 text-md" text = ":page_with_curl:" />
51
- </ Flex >
52
- < Box flex = { 1 } flexDirection = "column" >
53
- < LinkOverlay
54
- href = { href }
55
- as = { BaseLink }
56
- isExternal = { isExternal }
57
- textDecoration = "none"
58
- _hover = { { textDecoration : "none" } }
59
- hideArrow
60
- >
61
- < Text color = "text300" fontWeight = "semibold" margin = { 0 } >
31
+ </ Center >
32
+ < Stack className = "flex-1" >
33
+ < LinkOverlay href = { href } className = "no-underline" >
34
+ < p className = "font-bold text-gray-600 dark:text-gray-200" >
62
35
{ children }
63
- </ Text >
36
+ </ p >
64
37
</ LinkOverlay >
65
- </ Box >
66
- < Icon
67
- as = { AiOutlineArrowRight }
68
- alignSelf = "center"
69
- minWidth = { 8 }
70
- boxSize = { 6 }
71
- marginX = { 6 }
72
- _groupHover = { {
73
- fill : "primary.base" ,
74
- transition : "transform 0.1s" ,
75
- transform : `${ flipForRtl } scale(1.2)` ,
76
- rotate : isExternal ? "-45deg" : "0" ,
77
- } }
78
- transform = { flipForRtl }
38
+ </ Stack >
39
+
40
+ < AiOutlineArrowRight
41
+ className = { cn (
42
+ "mx-6 h-6 w-6 self-center" ,
43
+ "transition-transform duration-100 group-hover:scale-[1.2] group-hover:fill-primary" ,
44
+ isExternal ? "-rotate-45" : "rotate-0" ,
45
+ isRtl && isExternal ? "-rotate-[135deg]" : "" ,
46
+ isRtl && ! isExternal ? "-rotate-[180deg]" : ""
47
+ ) }
79
48
/>
80
49
</ Flex >
81
50
</ LinkBox >
0 commit comments