im dying inside

This commit is contained in:
Xyphyn committed 2023-06-24 13:00:09 -07:00
1 parent 061c7d6766
commit c9fc488ef2
20 files changed
+716 -10

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
<script lang="ts">
import { createEventDispatcher } from 'svelte'
import { Color } from '$lib/ui/colors.js'
export let color: Color = Color.secondary
export let loading = false
const dispatch = createEventDispatcher()
</script>
<button
on:click={(e) => dispatch('click', e)}
class="px-3 py-1.5 rounded-md {color} text-sm transition-all"
>
<div
class="flex flex-row items-center justify-center gap-2"
class:opacity-0={loading}
>
<slot name="icon" />
<slot />
</div>
<div class="mx-auto my-auto" class:hidden={!loading}>loading...</div>
</button>
+15
View File
@@ -0,0 +1,15 @@
<script lang="ts">
import { Color } from '$lib/ui/colors.js'
export let color: Color = Color.secondary
export let href = ''
</script>
<a
{href}
class="px-2 py-1 rounded-md {color} flex flex-row items-center
justify-center text-sm transition-all"
>
<slot name="icon" />
<slot />
</a>
+16
View File
@@ -0,0 +1,16 @@
<script lang="ts">
export let width = 48
</script>
<svg
{width}
viewBox="0 0 100 100"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
id="hexagon"
d="M45.5 10.8868C48.594 9.10042 52.406 9.10042 55.5 10.8868L82.3061 26.3632C85.4001 28.1496 87.3061 31.4508 87.3061 35.0235V65.9765C87.3061 69.5492 85.4001 72.8504 82.3061 74.6368L55.5 90.1132C52.406 91.8996 48.594 91.8996 45.5 90.1132L18.6939 74.6368C15.5999 72.8504 13.6939 69.5492 13.6939 65.9765V35.0235C13.6939 31.4508 15.5999 28.1496 18.6939 26.3632L45.5 10.8868Z"
class="fill-black dark:fill-white"
/>
</svg>
+35
View File
@@ -0,0 +1,35 @@
<script lang="ts">
import { createEventDispatcher } from 'svelte'
type T = $$Generic
export let options: T[]
export let optionNames: string[] = []
export let selected: T
export let separate = false
let clazz = ''
export { clazz as class }
const dispatcher = createEventDispatcher<{ select: T }>()
$: {
dispatcher('select', selected)
}
</script>
<div
class="flex overflow-hidden flex-row items-center w-max rounded-md {separate
? 'gap-2'
: ''}"
>
{#each options as option, index}
<button
class="px-3 py-2 text-sm
transition-colors {separate ? 'rounded-full' : ''}
{selected == option
? 'bg-black text-white dark:bg-white dark:text-black\
hover:bg-zinc-900 hover:dark:bg-zinc-300'
: 'bg-slate-100 dark:bg-zinc-900 hover:bg-slate-200 hover:dark:bg-zinc-800'} {clazz}
"
on:click={() => (selected = option)}
>
{optionNames[index] || option}
</button>
{/each}
</div>
+33
View File
@@ -0,0 +1,33 @@
<script lang="ts">
import Logo from '$lib/components/Logo.svelte'
export let routes: string[] = []
</script>
<nav
class="flex top-0 z-20 flex-row gap-4 items-center mt-2 w-full h-16
max-w-7xl mx-auto px-6"
>
<div class="flex flex-row gap-2 items-center mr-auto">
<a href="/">
<Logo width={40} />
</a>
{#if routes.length != 0}
{#each routes as route}
<svg
fill="none"
height="32"
viewBox="0 0 24 24"
width="32"
class="stroke-1 opacity-20 stroke-black dark:stroke-white"
>
<path d="M16.88 3.549L7.12 20.451" />
</svg>
<span>{route}</span>
{/each}
{/if}
</div>
<div
class="w-8 h-8 rounded-full ring-1 ring-slate-300 bg-slate-100 dark:bg-zinc-800"
/>
</nav>
+3
View File
@@ -0,0 +1,3 @@
import { LemmyHttp } from 'lemmy-js-client'
export const lemmy = new LemmyHttp('https://lemmy.ml')
+12
View File
@@ -0,0 +1,12 @@
/**
* This enum represents a UI color as tailwind classes.
*/
export enum Color {
'accent' = 'border border-black dark:border-white bg-black text-white\
dark:bg-white dark:text-black hover:text-inherit hover:bg-transparent hover:dark:bg-transparent active:bg-black/10 active:dark:bg-white/10',
'ghost' = 'bg-black/5 dark:bg-white/5 hover:bg-black/10 hover:dark:bg-white/10 text-black dark:text-white border border-transparent',
'secondary' = 'hover:bg-black/10 hover:dark:bg-white/10 text-black dark:text-white fill-black dark:fill-white',
'danger' = 'border border-red-500 bg-red-500 text-white hover:text-red-500 hover:bg-transparent',
'dangerSecondary' = 'hover:bg-red-500 text-red-500 hover:text-white',
}