Skip to content

Commit 1009efd

Browse files
authored
Merge pull request #8579 from TylerAPfledderer/refactor/doc-link-chakra-update
Update `DocLink` component (Post Chakra)
2 parents 73f74ba + 4b7c3ad commit 1009efd

File tree

1 file changed

+60
-54
lines changed

1 file changed

+60
-54
lines changed

src/components/DocLink.tsx

Lines changed: 60 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
import React from "react"
2-
import { Icon, Box, Text, Flex, LinkBox, LinkOverlay } from "@chakra-ui/react"
2+
import {
3+
Icon,
4+
Box,
5+
Text,
6+
Flex,
7+
LinkBox,
8+
LinkOverlay,
9+
useToken,
10+
} from "@chakra-ui/react"
311
import { AiOutlineArrowRight } from "react-icons/ai"
412
import Emoji from "./Emoji"
513
import Link from "./Link"
@@ -11,62 +19,60 @@ export interface IProps {
1119
}
1220

1321
const DocLink: React.FC<IProps> = ({ to, children, isExternal = false }) => {
22+
const linkBoxShadowColor = useToken("colors", "primary")
23+
1424
return (
15-
<LinkBox>
16-
<Box
17-
padding={4}
18-
borderRadius="sm"
19-
color="text"
20-
border="1px"
21-
borderStyle="solid"
22-
borderColor="border"
23-
_hover={{
24-
background: "tableBackgroundHover",
25-
borderRadius: "base",
26-
boxShadow: "0 0 1px var(--eth-colors-primary)",
27-
}}
28-
role="group"
25+
<LinkBox
26+
padding={4}
27+
borderRadius="sm"
28+
color="text"
29+
border="1px"
30+
borderStyle="solid"
31+
borderColor="border"
32+
_hover={{
33+
background: "tableBackgroundHover",
34+
borderRadius: "base",
35+
boxShadow: `0 0 1px ${linkBoxShadowColor}`,
36+
}}
37+
>
38+
<Flex
39+
zIndex={1}
40+
display="flex"
41+
flexDirection="row"
42+
flex={1}
43+
justifyContent="space-between"
2944
>
30-
<Flex
31-
position="relative"
32-
zIndex={1}
33-
display="flex"
34-
flexDirection="row"
35-
flex={1}
36-
justifyContent="space-between"
37-
>
38-
<Flex align="center">
39-
<Emoji fontSize="md" mr={4} text=":page_with_curl:" />
40-
</Flex>
41-
<Box flex={1} flexDirection="column">
42-
<LinkOverlay
43-
href={to}
44-
as={Link}
45-
isExternal={isExternal}
46-
textDecoration="none"
47-
_hover={{ textDecoration: "none" }}
48-
hideArrow
49-
>
50-
<Text color="text300" fontWeight="semibold" margin={0}>
51-
{children}
52-
</Text>
53-
</LinkOverlay>
54-
</Box>
55-
<Icon
56-
as={AiOutlineArrowRight}
57-
alignSelf="center"
58-
minWidth="2rem"
59-
boxSize={6}
60-
marginX={6}
61-
_groupHover={{
62-
fill: "primary",
63-
transition: "transform 0.1s",
64-
transform: "scale(1.2)",
65-
rotate: isExternal ? "-45deg" : "0",
66-
}}
67-
/>
45+
<Flex align="center">
46+
<Emoji fontSize="md" mr={4} text=":page_with_curl:" />
6847
</Flex>
69-
</Box>
48+
<Box flex={1} flexDirection="column">
49+
<LinkOverlay
50+
href={to}
51+
as={Link}
52+
isExternal={isExternal}
53+
textDecoration="none"
54+
_hover={{ textDecoration: "none" }}
55+
hideArrow
56+
>
57+
<Text color="text300" fontWeight="semibold" margin={0}>
58+
{children}
59+
</Text>
60+
</LinkOverlay>
61+
</Box>
62+
<Icon
63+
as={AiOutlineArrowRight}
64+
alignSelf="center"
65+
minWidth={8}
66+
boxSize={6}
67+
marginX={6}
68+
_groupHover={{
69+
fill: "primary",
70+
transition: "transform 0.1s",
71+
transform: "scale(1.2)",
72+
rotate: isExternal ? "-45deg" : "0",
73+
}}
74+
/>
75+
</Flex>
7076
</LinkBox>
7177
)
7278
}

0 commit comments

Comments
 (0)