Skip to content

Commit 4273779

Browse files
committed
Dont use theme variables in JS
1 parent 7ce4c59 commit 4273779

File tree

3 files changed

+17
-22
lines changed

3 files changed

+17
-22
lines changed

packages/mdx/src/index.scss

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,17 @@
107107
.ch-code-box-annotation {
108108
outline: 2px solid var(--ch-l-editor-infoForeground);
109109
}
110+
111+
.ch-code-label-annotation:hover {
112+
background: var(--ch-l-editor-lineHighlightBackground);
113+
.ch-code-label-annotation-text {
114+
display: block;
115+
}
116+
}
117+
.ch-code-label-annotation-text {
118+
position: absolute;
119+
right: 0;
120+
padding-right: 16px;
121+
opacity: 0.7;
122+
display: none;
123+
}

packages/mdx/src/mdx-client/annotations.tsx

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
LineWithElement,
77
} from "../smooth-code/partial-step-parser"
88
import { CopyButton } from "../smooth-code/copy-button"
9-
import { CSSV } from "utils/light/css"
109

1110
export function Annotation() {
1211
return (
@@ -140,28 +139,10 @@ function WithClass({
140139
}
141140

142141
function Label({ children, data, style }: AnnotationProps) {
143-
const bg = CSSV.editor.lineHighlightBackground
144-
const [hover, setHover] = React.useState(false)
145-
146142
return (
147-
<div
148-
style={{
149-
...style,
150-
background: hover ? bg : undefined,
151-
}}
152-
onMouseEnter={() => setHover(true)}
153-
onMouseLeave={() => setHover(false)}
154-
>
143+
<div className="ch-code-label-annotation" style={style}>
155144
{children}
156-
<div
157-
style={{
158-
position: "absolute",
159-
right: 0,
160-
paddingRight: 16,
161-
display: hover ? "block" : "none",
162-
opacity: 0.7,
163-
}}
164-
>
145+
<div className="ch-code-label-annotation-text">
165146
{data?.children || data}
166147
</div>
167148
</div>

packages/mdx/src/utils/light/css.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function vn(key: string) {
4343
return `--ch-l-${key.replace(".", "-")}`
4444
}
4545

46-
export const CSSV = {
46+
const CSSV = {
4747
colorScheme: v("colorScheme"),
4848
foreground: v("foreground"),
4949
background: v("background"),

0 commit comments

Comments
 (0)