add icon to public private toggle

This commit is contained in:
Christian Beutel
2025-04-11 16:23:26 +02:00
parent 61a6ca6b23
commit 7f1b5b5178
2 changed files with 10 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
<script lang="ts"> <script lang="ts">
interface Props { interface Props {
name?: string; name?: string;
icon?: string;
value?: boolean; value?: boolean;
label?: string; label?: string;
error?: string; error?: string;
@@ -10,6 +11,7 @@
let { let {
name = "", name = "",
icon = "",
value = $bindable(false), value = $bindable(false),
label = "", label = "",
error = "", error = "",
@@ -23,7 +25,10 @@
</script> </script>
<div> <div>
<label class="relative my-2 inline-flex items-center" class:cursor-pointer={!disabled}> <label
class="relative my-2 inline-flex items-center"
class:cursor-pointer={!disabled}
>
<input <input
{name} {name}
bind:checked={value} bind:checked={value}
@@ -38,6 +43,9 @@
></div> ></div>
{#if label} {#if label}
<span class="ms-3 text-sm font-medium">{label}</span> <span class="ms-3 text-sm font-medium">{label}</span>
{#if icon.length}
<i class="fa fa-{icon} ml-2"></i>
{/if}
{/if} {/if}
</label> </label>

View File

@@ -1084,7 +1084,7 @@
></Select> ></Select>
</div> </div>
<Toggle name="public" label={$_("public")}></Toggle> <Toggle name="public" label={$formData.public ? $_("public") : $_("private")} icon={$formData.public ? "globe" : "lock"}></Toggle>
<hr class="border-separator" /> <hr class="border-separator" />
<h3 class="text-xl font-semibold"> <h3 class="text-xl font-semibold">
{$_("waypoints", { values: { n: 2 } })} {$_("waypoints", { values: { n: 2 } })}