File tree Expand file tree Collapse file tree 2 files changed +7
-11
lines changed
src/components/TableOfContents Expand file tree Collapse file tree 2 files changed +7
-11
lines changed Original file line number Diff line number Diff line change 1
1
import React from "react"
2
2
import { ChakraProps , List , ListItem } from "@chakra-ui/react"
3
3
import { Item } from "./utils"
4
- import TableOfContentsLink from "./TableOfContentsLink"
4
+ import Link from "./TableOfContentsLink"
5
5
6
6
export interface IPropsItemsList extends ChakraProps {
7
7
items ?: Array < Item >
@@ -26,11 +26,7 @@ const ItemsList: React.FC<IPropsItemsList> = ({
26
26
{ items . map ( ( item , index ) => (
27
27
< ListItem key = { index } m = { 0 } { ...rest } >
28
28
{ item . title && (
29
- < TableOfContentsLink
30
- depth = { depth }
31
- item = { item }
32
- activeHash = { activeHash }
33
- />
29
+ < Link depth = { depth } item = { item } activeHash = { activeHash } />
34
30
) }
35
31
{ item . items && (
36
32
< List
Original file line number Diff line number Diff line change 1
1
import React from "react"
2
2
import { Link as GatsbyLink } from "gatsby"
3
3
import { SystemStyleObject , cssVar } from "@chakra-ui/react"
4
- import Link from "../Link"
4
+ import CustomLink from "../Link"
5
5
import { getCustomId , Item , trimmedTitle } from "./utils"
6
6
7
7
export interface IPropsTableOfContentsLink {
@@ -10,7 +10,7 @@ export interface IPropsTableOfContentsLink {
10
10
activeHash ?: string
11
11
}
12
12
13
- const TableOfContentsLink : React . FC < IPropsTableOfContentsLink > = ( {
13
+ const Link : React . FC < IPropsTableOfContentsLink > = ( {
14
14
depth,
15
15
item,
16
16
activeHash,
@@ -45,7 +45,7 @@ const TableOfContentsLink: React.FC<IPropsTableOfContentsLink> = ({
45
45
}
46
46
47
47
return (
48
- < Link
48
+ < CustomLink
49
49
as = { GatsbyLink }
50
50
to = { url }
51
51
className = { classes }
@@ -82,8 +82,8 @@ const TableOfContentsLink: React.FC<IPropsTableOfContentsLink> = ({
82
82
} }
83
83
>
84
84
{ trimmedTitle ( item . title ) }
85
- </ Link >
85
+ </ CustomLink >
86
86
)
87
87
}
88
88
89
- export default TableOfContentsLink
89
+ export default Link
You can’t perform that action at this time.
0 commit comments