misc: add account logging in
This commit is contained in:
1 parent
7d3f29d9eb
commit
f71ad4be8e
21 files changed
+686
-151
No files matched your search
@@ -0,0 +1,58 @@
|
||||
<script lang="ts">
|
||||
import { expoOut } from 'svelte/easing'
|
||||
import { scale } from 'svelte/transition'
|
||||
|
||||
export let open = false
|
||||
|
||||
let clazz = ''
|
||||
export { clazz as class }
|
||||
|
||||
export let itemsClass = ''
|
||||
|
||||
export let absolute = false
|
||||
export let rtl = true
|
||||
export let top = false
|
||||
|
||||
let element: any
|
||||
</script>
|
||||
|
||||
<svelte:body
|
||||
on:click={(event) => {
|
||||
let path = event.composedPath()
|
||||
|
||||
if (!path.includes(element)) {
|
||||
if (open) {
|
||||
open = false
|
||||
}
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<button
|
||||
class="overflow-visible z-30 {absolute
|
||||
? 'absolute'
|
||||
: 'relative'} cursor-auto {clazz}"
|
||||
on:click={() => (open = !open)}
|
||||
bind:this={element}
|
||||
>
|
||||
<slot name="button" />
|
||||
{#if open}
|
||||
<div
|
||||
transition:scale|local={{
|
||||
duration: 200,
|
||||
start: 0.95,
|
||||
easing: expoOut,
|
||||
}}
|
||||
class="absolute {rtl
|
||||
? 'origin-top-right right-0'
|
||||
: 'origin-top-left left-0'}
|
||||
{top ? 'bottom-[100%] origin-bottom-left' : 'top-[100%]'}
|
||||
rounded-md py-2 min-w-[16rem] my-2 flex flex-col shadow-lg {itemsClass
|
||||
? itemsClass
|
||||
: 'bg-white dark:bg-zinc-900'}"
|
||||
>
|
||||
{#if open}
|
||||
<slot />
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</button>
|
||||
Reference in new issue
Block a user