misc: add account logging in

This commit is contained in:
Xyphyn committed 2023-07-03 14:57:53 -07:00
1 parent 7d3f29d9eb
commit f71ad4be8e
21 files changed
+686 -151

No files matched your search

+8 -3
View File
@@ -1,7 +1,12 @@
<script lang="ts">
let clazz = ''
export { clazz as class }
</script>
<div
class="sticky top-4 bg-white border border-slate-200
dark:border-zinc-800 dark:bg-zinc-900 break-words hidden lg:flex
flex-col gap-4 p-8 max-w-sm rounded-md h-max max-h-[calc(100vh-2rem)] overflow-auto"
class="bg-white border border-slate-200
dark:border-zinc-800 dark:bg-zinc-900 break-words
flex-col gap-4 p-4 max-w-lg rounded-md {clazz}"
>
<slot />
</div>
+46
View File
@@ -0,0 +1,46 @@
<div class="loading">
<div class="dot dot1" />
<div class="dot dot2" />
<div class="dot dot3" />
</div>
<style>
.loading {
display: flex;
justify-content: center;
align-items: center;
}
.dot {
width: 5px;
height: 5px;
border-radius: 50%;
background-color: #555;
margin: 0px 1px;
animation: blink 750ms infinite;
}
.dot1 {
animation-delay: 0s;
}
.dot2 {
animation-delay: 0.2s;
}
.dot3 {
animation-delay: 0.4s;
}
@keyframes blink {
0% {
opacity: 0.6;
}
20% {
opacity: 1;
}
100% {
opacity: 0.6;
}
}
</style>
+34 -8
View File
@@ -1,7 +1,15 @@
<script lang="ts">
import Link from '$lib/components/input/Link.svelte'
import Logo from '$lib/components/ui/Logo.svelte'
import { instance_url } from '$lib/lemmy.js'
import Menu from '$lib/components/ui/menu/Menu.svelte'
import MenuButton from '$lib/components/ui/menu/MenuButton.svelte'
import { instance_url, user } from '$lib/lemmy.js'
import {
ArrowLeftOnRectangle,
ArrowRightOnRectangle,
Cog6Tooth,
Icon,
} from 'svelte-hero-icons'
</script>
<nav
@@ -14,19 +22,37 @@
<div class="flex flex-col">
<span class="font-bold">Xylemmy</span>
{#if $instance_url}
<a
class="text-xs opacity-50 hover:opacity-100 hover:underline
<span
class="text-xs opacity-50
transition-opacity"
href="/instance"
>
{new URL(`https://${$instance_url}`).hostname}
</a>
</span>
{/if}
</div>
</a>
</div>
<Link href="/communities">Communities</Link>
<div
class="w-8 h-8 rounded-full ring-1 ring-slate-300 bg-slate-100 dark:bg-zinc-800"
/>
<Menu>
<button
class="w-8 h-8 rounded-full ring-1 ring-slate-300 bg-slate-100 dark:bg-zinc-800"
aria-label="Profile"
slot="button"
>
{#if $user}
<img
src={$user.person_view.person.avatar ??
'https://xylo.xylight.dev/img/logo-background.svg'}
alt=""
width={32}
height={32}
/>
{/if}
</button>
<span class="text-xs opacity-80 text-left mx-4 my-2">Profile</span>
<MenuButton link href="/login">
<Icon src={ArrowLeftOnRectangle} mini width={16} /> Log in
</MenuButton>
<MenuButton><Icon src={Cog6Tooth} mini width={16} /> Settings</MenuButton>
</Menu>
</nav>
+7
View File
@@ -0,0 +1,7 @@
<div
class="sticky top-4 bg-white border border-slate-200
dark:border-zinc-800 dark:bg-zinc-900 break-words hidden lg:flex
flex-col gap-4 p-8 max-w-sm rounded-md h-max max-h-[calc(100vh-2rem)] overflow-auto"
>
<slot />
</div>
+58
View File
@@ -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>
@@ -0,0 +1,27 @@
<script lang="ts">
import { Color } from '$lib/ui/colors'
import { createEventDispatcher } from 'svelte'
export let color: Color = Color.secondary
export let link = false
export let href = ''
const click = createEventDispatcher()
</script>
{#if link}
<a
{href}
class="flex flex-row gap-2 items-center px-4 py-2 w-full text-sm transition-colors {color}"
>
<slot />
</a>
{:else}
<button
on:click={(e) => click('click', e)}
type="button"
class="flex flex-row gap-2 items-center px-4 py-2 w-full text-sm transition-colors {color}"
>
<slot />
</button>
{/if}