Skip to content

Commit 585f803

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
1 parent 9b27fb5 commit 585f803

File tree

1 file changed

+8
-11
lines changed
  • web/libs/editor/src/components/Label

1 file changed

+8
-11
lines changed

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

Lines changed: 8 additions & 11 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,22 @@ 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").mod({ empty, hidden, selected, clickable: !!onClick, margins }).mix(className).toClassName()}
4542
style={styles}
4643
onClick={onClick}
4744
{...rest}
4845
>
49-
<Elem tag="span" name="text">
46+
<span className={cn("label").elem("text").toClassName()}>
5047
{children}
51-
</Elem>
48+
</span>
5249
{hotkey ? (
53-
<Elem tag="span" name="hotkey">
50+
<span className={cn("label").elem("hotkey").toClassName()}>
5451
{hotkey}
55-
</Elem>
52+
</span>
5653
) : null}
57-
</Block>
54+
</span>
5855
);
5956
},
6057
);

0 commit comments

Comments
 (0)