From 46a3c3e8fc84c14903ff9bcf302578dce88cd96c Mon Sep 17 00:00:00 2001 From: Ilia Mashkov Date: Sat, 7 Feb 2026 11:24:44 +0300 Subject: [PATCH] feat(ComboControl): add reduced flag that removes increase/decrease buttons keeping the slider popover --- .../SetupFont/ui/SetupFontMenu.svelte | 3 +- .../ui/ComboControl/ComboControl.svelte | 53 +++++++++++-------- 2 files changed, 33 insertions(+), 23 deletions(-) diff --git a/src/features/SetupFont/ui/SetupFontMenu.svelte b/src/features/SetupFont/ui/SetupFontMenu.svelte index 197c0a2..e298cad 100644 --- a/src/features/SetupFont/ui/SetupFontMenu.svelte +++ b/src/features/SetupFont/ui/SetupFontMenu.svelte @@ -31,7 +31,7 @@ $effect(() => { }); -
+
{#each controlManager.controls as control (control.id)} { increaseLabel={control.increaseLabel} decreaseLabel={control.decreaseLabel} controlLabel={control.controlLabel} + reduced={responsive.isMobile} /> {/each}
diff --git a/src/shared/ui/ComboControl/ComboControl.svelte b/src/shared/ui/ComboControl/ComboControl.svelte index 73758e5..78eeb7d 100644 --- a/src/shared/ui/ComboControl/ComboControl.svelte +++ b/src/shared/ui/ComboControl/ComboControl.svelte @@ -26,7 +26,7 @@ import PlusIcon from '@lucide/svelte/icons/plus'; import type { ChangeEventHandler } from 'svelte/elements'; import IconButton from '../IconButton/IconButton.svelte'; -interface ComboControlProps { +interface Props { /** * Text for increase button aria-label */ @@ -43,6 +43,10 @@ interface ComboControlProps { * Control instance */ control: TypographyControl; + /** + * Reduced amount of controls + */ + reduced?: boolean; } const { @@ -50,7 +54,8 @@ const { decreaseLabel, increaseLabel, controlLabel, -}: ComboControlProps = $props(); + reduced = false, +}: Props = $props(); // Local state for the slider to prevent infinite loops // svelte-ignore state_referenced_locally - $state captures initial value, $effect syncs updates @@ -80,16 +85,18 @@ const handleSliderChange = (newValue: number) => { - - {#snippet icon({ className })} - - {/snippet} - + {#if !reduced} + + {#snippet icon({ className })} + + {/snippet} + + {/if} {#snippet child({ props })} @@ -127,16 +134,18 @@ const handleSliderChange = (newValue: number) => { - - {#snippet icon({ className })} - - {/snippet} - + {#if !reduced} + + {#snippet icon({ className })} + + {/snippet} + + {/if} {#if controlLabel}