diff options
| author | ivarlovlie <git@ivarlovlie.no> | 2022-10-03 18:04:19 +0200 |
|---|---|---|
| committer | ivarlovlie <git@ivarlovlie.no> | 2022-10-03 18:04:19 +0200 |
| commit | 3352727aa638fcfcc6461d2aaded8ef9603acc0d (patch) | |
| tree | 880b381af0c1e717803c6fa233cc8792193d84dd /apps/kit/src/lib/components/switch.svelte | |
| parent | c5af87a9312affc84ee9dbc654f8a4942f0d1e1c (diff) | |
| download | greatoffice-3352727aa638fcfcc6461d2aaded8ef9603acc0d.tar.xz greatoffice-3352727aa638fcfcc6461d2aaded8ef9603acc0d.zip | |
feat: Initial setup facilitating testing
Diffstat (limited to 'apps/kit/src/lib/components/switch.svelte')
| -rw-r--r-- | apps/kit/src/lib/components/switch.svelte | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/apps/kit/src/lib/components/switch.svelte b/apps/kit/src/lib/components/switch.svelte index c958b0f..16da23a 100644 --- a/apps/kit/src/lib/components/switch.svelte +++ b/apps/kit/src/lib/components/switch.svelte @@ -3,12 +3,17 @@ </script> <script lang="ts"> + import pwKey from "$actions/pwKey"; + + export let enabled = false; export let type: SwitchType = "default"; export let srText = "Use setting"; export let label: string | undefined = undefined; export let description: string | undefined = undefined; export let rightAlignedLabelDescription = false; + export let _pwKey:string|undefined = undefined; + $: colorClass = enabled ? "bg-teal-600 focus:ring-teal-500" : "bg-gray-200 focus:ring-teal-500"; @@ -41,6 +46,7 @@ class="group relative inline-flex h-5 w-10 flex-shrink-0 cursor-pointer items-center justify-center rounded-full focus:outline-none focus:ring-2 focus:ring-offset-2" role="switch" aria-checked={enabled} + use:pwKey={_pwKey} on:click={toggle} > <span class="sr-only">{srText}</span> @@ -63,6 +69,7 @@ class="{colorClass} relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-offset-2" role="switch" aria-checked={enabled} + use:pwKey={_pwKey} on:click={toggle} > <span class="sr-only">{srText}</span> @@ -113,6 +120,7 @@ class="{colorClass} relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-offset-2" role="switch" aria-checked={enabled} + use:pwKey={_pwKey} on:click={toggle} > <span class="sr-only">{srText}</span> |
