1
0
mirror of https://github.com/pocket-id/pocket-id.git synced 2026-02-04 13:21:45 +00:00

fix: improve accent color picker disabled state

This commit is contained in:
Elias Schneider
2025-06-27 22:38:21 +02:00
parent 052ac008c3
commit d976bf5965
2 changed files with 11 additions and 9 deletions

View File

@@ -7,8 +7,9 @@
let {
selectedColor = $bindable(),
previousColor
}: { selectedColor: string; previousColor: string } = $props();
previousColor,
disabled = false
}: { selectedColor: string; previousColor: string; disabled?: boolean } = $props();
let showCustomColorDialog = $state(false);
const accentColors = [
@@ -30,10 +31,6 @@
selectedColor = accentValue;
applyAccentColor(accentValue);
}
function handleCustomColorApply(color: string) {
handleAccentColorChange(color);
}
</script>
<RadioGroup.Root
@@ -54,7 +51,7 @@
{@render colorOption('Custom', 'custom', false, true)}
</RadioGroup.Root>
<CustomColorDialog bind:open={showCustomColorDialog} onApply={handleCustomColorApply} />
<CustomColorDialog bind:open={showCustomColorDialog} onApply={handleAccentColorChange} />
{#snippet colorOption(
label: string,
@@ -66,9 +63,13 @@
<RadioGroup.Item id={color} value={color} class="sr-only" />
<Label
for={color}
class="cursor-pointer {isCustomColorSelection ? 'group' : ''}"
class={{
'cursor-pointer': !disabled,
'cursor-not-allowed': disabled,
group: isCustomColorSelection
}}
onclick={() => {
if (isCustomColorSelection) {
if (isCustomColorSelection && !disabled) {
showCustomColorDialog = true;
}
}}

View File

@@ -161,6 +161,7 @@
<AccentColorPicker
previousColor={appConfig.accentColor}
bind:selectedColor={$inputs.accentColor.value}
disabled={$appConfigStore.uiConfigDisabled}
/>
</div>
</div>