File tree Expand file tree Collapse file tree 2 files changed +2
-19
lines changed
src/components/TableOfContents Expand file tree Collapse file tree 2 files changed +2
-19
lines changed Original file line number Diff line number Diff line change @@ -25,9 +25,7 @@ const ItemsList: React.FC<IPropsItemsList> = ({
25
25
< >
26
26
{ items . map ( ( item , index ) => (
27
27
< ListItem key = { index } m = { 0 } { ...rest } >
28
- { item . title && (
29
- < Link depth = { depth } item = { item } activeHash = { activeHash } />
30
- ) }
28
+ { item . title && < Link item = { item } activeHash = { activeHash } /> }
31
29
{ item . items && (
32
30
< List
33
31
key = { item . title }
Original file line number Diff line number Diff line change @@ -5,26 +5,12 @@ import CustomLink from "../Link"
5
5
import { getCustomId , Item , trimmedTitle } from "./utils"
6
6
7
7
export interface IPropsTableOfContentsLink {
8
- depth : number
9
8
item : Item
10
9
activeHash ?: string
11
10
}
12
11
13
- const Link : React . FC < IPropsTableOfContentsLink > = ( {
14
- depth,
15
- item,
16
- activeHash,
17
- } ) => {
12
+ const Link : React . FC < IPropsTableOfContentsLink > = ( { item } ) => {
18
13
const url = `#${ getCustomId ( item . title ) } `
19
- const isActive = activeHash === url
20
- const isNested = depth === 2
21
- let classes = ""
22
- if ( isActive ) {
23
- classes += " active"
24
- }
25
- if ( isNested ) {
26
- classes += " nested"
27
- }
28
14
29
15
const $dotBg = cssVar ( "dot-bg" )
30
16
@@ -48,7 +34,6 @@ const Link: React.FC<IPropsTableOfContentsLink> = ({
48
34
< CustomLink
49
35
as = { GatsbyLink }
50
36
to = { url }
51
- className = { classes }
52
37
textDecoration = "none"
53
38
display = "inline-block"
54
39
position = "relative"
You can’t perform that action at this time.
0 commit comments