1
1
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"
12
4
13
5
interface Item {
14
6
id : string
@@ -33,40 +25,21 @@ const TableOfContentsLink: React.FC<ITableOfContentsLinkProps> = ({
33
25
classes += " active"
34
26
}
35
27
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
+ >
37
38
{ title }
38
- </ StyledTableOfContentsLink >
39
+ </ Link >
39
40
)
40
41
}
41
42
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
-
70
43
export interface IProps {
71
44
items : Array < Item >
72
45
}
@@ -75,17 +48,17 @@ const StakingHomeTableOfContents: React.FC<IProps> = ({ items }) => {
75
48
if ( ! items ) return null
76
49
77
50
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 } >
80
53
{ items . map ( ( item , index ) => (
81
- < ListItem key = { index } >
54
+ < ListItem key = { index } m = { 0 } >
82
55
< div >
83
56
< TableOfContentsLink item = { item } />
84
57
</ div >
85
58
</ ListItem >
86
59
) ) }
87
- </ OuterList >
88
- </ Aside >
60
+ </ List >
61
+ </ Box >
89
62
)
90
63
}
91
64
0 commit comments