Skip to content

Commit 5831b7b

Browse files
authored
Merge pull request #479 from pascalorg/feat/smart-unit-suffix
editor: smart unit suffix — dim on focus, yield to explicit units
2 parents 2d4e7be + 5b4b267 commit 5831b7b

2 files changed

Lines changed: 20 additions & 2 deletions

File tree

packages/editor/src/components/ui/controls/metric-control.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,16 @@ export function MetricControl({
330330
type="text"
331331
value={inputValue}
332332
/>
333-
{displayUnit && <span className="ml-[1px] text-muted-foreground">{displayUnit}</span>}
333+
{displayUnit && (
334+
<span
335+
className={cn(
336+
'ml-[1px] transition-opacity duration-150',
337+
hint ? 'opacity-0' : 'text-muted-foreground/40',
338+
)}
339+
>
340+
{displayUnit}
341+
</span>
342+
)}
334343
</div>
335344
) : (
336345
<div

packages/editor/src/components/ui/controls/slider-control.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,16 @@ export function SliderControl({
329329
type="text"
330330
value={inputValue}
331331
/>
332-
{displayUnit && <span className="ml-[1px] text-muted-foreground">{displayUnit}</span>}
332+
{displayUnit && (
333+
<span
334+
className={cn(
335+
'ml-[1px] transition-opacity duration-150',
336+
hint ? 'opacity-0' : 'text-muted-foreground/40',
337+
)}
338+
>
339+
{displayUnit}
340+
</span>
341+
)}
333342
</>
334343
) : (
335344
<div

0 commit comments

Comments
 (0)