Skip to content

Commit 5ef275a

Browse files
committed
refactor(bem): replace Block/Elem with cn() in Video/HtxVideo.jsx
Migrated Video tag component from Block/Elem to cn() helper. - Replaced Block/Elem imports with cn import - Replaced <Block name="video-segmentation"> with <div className={cn("video-segmentation")...}> - Replaced nested <Block name="video"> with <div className={cn("video")...}> - Replaced <Elem name="main"> with <div className={cn("video").elem("main")...}> (Note: uses "video" as block, not "video-segmentation") - Replaced <Elem name="timeline" tag={Timeline}> with <Timeline className={cn("video-segmentation").elem("timeline")...}> (Note: uses "video-segmentation" as block - outside nested "video" Block scope) - Preserved refs for mainContentRef, videoBlockRef, videoContainerRef - Added type assertions for all refs - Nested Blocks create correct scope boundaries - No behavior change, equivalent class strings
1 parent 7969ed7 commit 5ef275a

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

web/libs/editor/src/tags/object/Video/HtxVideo.jsx

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
import { defaultStyle } from "../../../core/Constants";
2020
import { useFullscreen } from "../../../hooks/useFullscreen";
2121
import { useToggle } from "../../../hooks/useToggle";
22-
import { Block, Elem } from "../../../utils/bem";
22+
import { cn } from "../../../utils/bem";
2323
import ResizeObserver from "../../../utils/resize-observer";
2424
import { clamp, isDefined } from "../../../utils/utilities";
2525
import "./Video.scss";
@@ -497,15 +497,15 @@ const HtxVideoView = ({ item, store }) => {
497497

498498
return (
499499
<ObjectTag item={item}>
500-
<Block name="video-segmentation" ref={mainContentRef} mod={{ fullscreen: isFullScreen }}>
500+
<div className={cn("video-segmentation").mod({ fullscreen: isFullScreen }).toClassName()} ref={mainContentRef as any}>
501501
{item.errors?.map((error, i) => (
502502
<ErrorMessage key={`err-${i}`} error={error} />
503503
))}
504504

505-
<Block name="video" mod={{ fullscreen: isFullScreen }} ref={videoBlockRef}>
506-
<Elem
507-
name="main"
508-
ref={videoContainerRef}
505+
<div className={cn("video").mod({ fullscreen: isFullScreen }).toClassName()} ref={videoBlockRef as any}>
506+
<div
507+
className={cn("video").elem("main").toClassName()}
508+
ref={videoContainerRef as any}
509509
style={{ height: Number(item.height) }}
510510
onMouseDown={handlePan}
511511
onWheel={onZoomChange}
@@ -553,13 +553,12 @@ const HtxVideoView = ({ item, store }) => {
553553
/>
554554
</>
555555
)}
556-
</Elem>
557-
</Block>
556+
</div>
557+
</div>
558558

559559
{loaded && (
560-
<Elem
561-
name="timeline"
562-
tag={Timeline}
560+
<Timeline
561+
className={cn("video-segmentation").elem("timeline").toClassName()}
563562
playing={isSyncedBuffering && item.isBuffering ? item.wasPlayingBeforeBuffering : playing}
564563
buffering={isSyncedBuffering ? item.isBuffering : false}
565564
length={videoLength}
@@ -612,7 +611,7 @@ const HtxVideoView = ({ item, store }) => {
612611
onAction={handleAction}
613612
/>
614613
)}
615-
</Block>
614+
</div>
616615
</ObjectTag>
617616
);
618617
};

0 commit comments

Comments
 (0)