Skip to content

Commit 4f6d45a

Browse files
refactor(staking-home-of-content): migrate to Chakra
1 parent 3d32135 commit 4f6d45a

File tree

1 file changed

+18
-45
lines changed

1 file changed

+18
-45
lines changed

src/components/Staking/StakingHomeTableOfContents.tsx

Lines changed: 18 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
import React from "react"
2-
import { motion } from "framer-motion"
3-
import { Link } from "gatsby"
4-
import styled from "@emotion/styled"
5-
6-
const StyledTableOfContentsLink = styled(Link)`
7-
position: relative;
8-
display: inline-block;
9-
color: ${({ theme }) => theme.colors.text300};
10-
margin-bottom: 0.5rem !important;
11-
`
2+
import { Link as GatsbyLink } from "gatsby"
3+
import { Box, Link, List, ListItem } from "@chakra-ui/react"
124

135
interface Item {
146
id: string
@@ -33,40 +25,21 @@ const TableOfContentsLink: React.FC<ITableOfContentsLinkProps> = ({
3325
classes += " active"
3426
}
3527
return (
36-
<StyledTableOfContentsLink to={url} className={classes}>
28+
<Link
29+
as={GatsbyLink}
30+
to={url}
31+
className={classes}
32+
position="relative"
33+
display="inline-block"
34+
color="text300"
35+
// `li :last-child` global selector wants to override this without `!important`
36+
mb="0.5rem !important"
37+
>
3738
{title}
38-
</StyledTableOfContentsLink>
39+
</Link>
3940
)
4041
}
4142

42-
const OuterList = styled(motion.ul)`
43-
list-style-type: none;
44-
list-style-image: none;
45-
padding: 0;
46-
margin: 0;
47-
font-size: 1.25rem;
48-
text-align: right;
49-
line-height: 1.6;
50-
font-weight: 400;
51-
padding-right: 0.25rem;
52-
padding-left: 1rem;
53-
54-
@media (max-width: ${(props) => props.theme.breakpoints.l}) {
55-
display: none;
56-
}
57-
`
58-
59-
const Aside = styled.aside`
60-
padding: 0rem;
61-
text-align: right;
62-
margin-bottom: 2rem;
63-
overflow-y: auto;
64-
`
65-
66-
const ListItem = styled.li`
67-
margin: 0;
68-
`
69-
7043
export interface IProps {
7144
items: Array<Item>
7245
}
@@ -75,17 +48,17 @@ const StakingHomeTableOfContents: React.FC<IProps> = ({ items }) => {
7548
if (!items) return null
7649

7750
return (
78-
<Aside>
79-
<OuterList>
51+
<Box as="nav" p={0} textAlign="right" mb={8} overflowY="auto">
52+
<List fontSize="xl" lineHeight={1.6} fontWeight={400} ps={4} pe={1} m={0}>
8053
{items.map((item, index) => (
81-
<ListItem key={index}>
54+
<ListItem key={index} m={0}>
8255
<div>
8356
<TableOfContentsLink item={item} />
8457
</div>
8558
</ListItem>
8659
))}
87-
</OuterList>
88-
</Aside>
60+
</List>
61+
</Box>
8962
)
9063
}
9164

0 commit comments

Comments
 (0)