Skip to content

Commit 997bf55

Browse files
committed
refactor(bem): replace Block/Elem with cn() in Label.jsx
Migrated Label component from Block/Elem to cn() helper. - Replaced Block/Elem imports with cn import - Replaced <Block name="label" tag="span"> with <span className={cn("label")...}> - Replaced <Elem tag="span" name="text"> with <span className={cn("label").elem("text")...}> - Replaced <Elem tag="span" name="hotkey"> with <span className={cn("label").elem("hotkey")...}> - Preserved ref, mods, mix, style, onClick, and all props - No behavior change, equivalent class strings label
1 parent 32f3b35 commit 997bf55

File tree

1 file changed

+9
-15
lines changed
  • web/libs/editor/src/components/Label

1 file changed

+9
-15
lines changed

web/libs/editor/src/components/Label/Label.jsx

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import chroma from "chroma-js";
22
import React, { useMemo } from "react";
3-
import { Block, Elem } from "../../utils/bem";
3+
import { cn } from "../../utils/bem";
44
import { asVars } from "../../utils/styles";
55

66
import "./Label.scss";
@@ -36,25 +36,19 @@ export const Label = React.forwardRef(
3636
}, [color]);
3737

3838
return (
39-
<Block
40-
tag="span"
39+
<span
4140
ref={ref}
42-
name="label"
43-
mod={{ empty, hidden, selected, clickable: !!onClick, margins }}
44-
mix={className}
41+
className={cn("label")
42+
.mod({ empty, hidden, selected, clickable: !!onClick, margins })
43+
.mix(className)
44+
.toClassName()}
4545
style={styles}
4646
onClick={onClick}
4747
{...rest}
4848
>
49-
<Elem tag="span" name="text">
50-
{children}
51-
</Elem>
52-
{hotkey ? (
53-
<Elem tag="span" name="hotkey">
54-
{hotkey}
55-
</Elem>
56-
) : null}
57-
</Block>
49+
<span className={cn("label").elem("text").toClassName()}>{children}</span>
50+
{hotkey ? <span className={cn("label").elem("hotkey").toClassName()}>{hotkey}</span> : null}
51+
</span>
5852
);
5953
},
6054
);

0 commit comments

Comments
 (0)