This repository has been archived by the owner on Oct 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
65 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<script lang="ts"> | ||
export let options: any[]; | ||
export let selected: any = undefined; | ||
export let open: boolean = false; | ||
export let displayWith: (value: any) => any = undefined; | ||
if (!displayWith) { | ||
displayWith = (value) => value; | ||
} | ||
</script> | ||
|
||
<div class="dropdown dropdown-hover {open ? 'dropdown-open' : ''}"> | ||
{#if $$slots.default} | ||
<div tabindex="0" class="m-1 btn"><slot /></div> | ||
{/if} | ||
<ul tabindex="0" class="p-2 shadow menu dropdown-content bg-base-100 rounded-box w-52"> | ||
{#each options as option} | ||
<li on:click={() => (selected = option)}> | ||
<a>{displayWith(option)}</a> | ||
</li> | ||
{/each} | ||
</ul> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<script lang="ts"> | ||
export let options: any[]; | ||
export let selected: any = undefined; | ||
export let displayWith: (value: any) => any = undefined; | ||
if (!displayWith) { | ||
displayWith = (value) => `${value}s`; | ||
} | ||
</script> | ||
|
||
<ul class="menu py-3 bg-base-300 rounded-box horizontal"> | ||
<li class="menu-title"> | ||
<span><slot /></span> | ||
</li> | ||
{#each options as option} | ||
<li on:click={() => (selected = option)}> | ||
<a class="rounded-lg {selected === option ? 'bg-primary' : ''}">{displayWith(option)}</a> | ||
</li> | ||
{/each} | ||
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<script lang="ts"> | ||
export let active: boolean = false; | ||
export let color: 'toggle-primary' | 'toggle-secondary' | 'toggle-accent' | '' = 'toggle-primary'; | ||
</script> | ||
|
||
<span class="form-control inline-flex"> | ||
<span class="m-2"><slot /></span> | ||
|
||
<span class="m-2"> | ||
<input type="checkbox" checked={active} class="toggle {color}" /> | ||
</span> | ||
</span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters