Skip to content

Commit 942167f

Browse files
committed
Change code link to hover
1 parent 3be43db commit 942167f

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

packages/mdx/src/client/section.tsx

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,8 @@ export function Section({
6262
}
6363

6464
export function SectionCode() {
65-
const { props, setFocus } = React.useContext(
66-
SectionContext
67-
)
65+
const { props, setFocus } =
66+
React.useContext(SectionContext)
6867

6968
const onTabClick = (filename: string) => {
7069
setFocus({ fileName: filename, focus: null, id: "" })
@@ -84,27 +83,30 @@ export function SectionLink({
8483
file?: string
8584
children: React.ReactNode
8685
}) {
87-
const {
88-
setFocus,
89-
resetFocus,
90-
selectedId,
91-
} = React.useContext(SectionContext)
86+
const { setFocus, resetFocus, selectedId } =
87+
React.useContext(SectionContext)
9288

9389
const isSelected = selectedId === id
94-
const handleClick = isSelected
95-
? resetFocus
96-
: () => setFocus({ fileName: file, focus, id })
90+
// const handleClick = isSelected
91+
// ? resetFocus
92+
// : () => setFocus({ fileName: file, focus, id })
9793

9894
return (
9995
<span
10096
style={{
10197
textDecoration: "underline",
10298
textDecorationStyle: "dotted",
10399
cursor: "pointer",
104-
backgroundColor: isSelected ? "yellow" : undefined,
100+
backgroundColor: isSelected
101+
? "#bae6fd66"
102+
: undefined,
105103
}}
106-
onClick={handleClick}
104+
// onClick={handleClick}
107105
children={children}
106+
onMouseOver={() =>
107+
setFocus({ fileName: file, focus, id })
108+
}
109+
onMouseOut={resetFocus}
108110
/>
109111
)
110112
}

0 commit comments

Comments
 (0)