feat: change the way placeholders work

This commit is contained in:
Xyphyn committed 2023-08-26 10:59:19 -07:00
1 parent 8aa62b046e
commit e86d436c86
12 files changed
+121 -96

No files matched your search

+8 -2
View File
@@ -1,5 +1,6 @@
<script lang="ts">
import Spinner from '$lib/components/ui/loader/Spinner.svelte'
import { Icon, type IconSource } from 'svelte-hero-icons'
type ButtonColor = keyof typeof buttonColor
type ButtonSize = keyof typeof buttonSize
@@ -66,6 +67,7 @@
export let size: ButtonSize = 'md'
export let rounded: ButtonRoundness = 'md'
export let alignment: ButtonAlignment = 'center'
export let icon: IconSource | undefined = undefined
export let loaderWidth: number | undefined = undefined
@@ -108,8 +110,10 @@
? 16
: 16}
/>
{:else}
{:else if $$slots.icon}
<slot name="icon" />
{:else if icon}
<Icon src={icon} size="16" mini />
{/if}
<slot />
</div>
@@ -148,8 +152,10 @@
? 16
: 16}
/>
{:else}
{:else if $$slots.icon}
<slot name="icon" />
{:else if icon}
<Icon src={icon} size="16" mini />
{/if}
<slot />
</div>
@@ -12,10 +12,12 @@
{#if posts.length == 0}
<div class="h-full grid place-items-center">
<Placeholder>
<Icon src={ArchiveBox} size="32" solid slot="icon" />
<span slot="title">No posts</span>
<Button href="/communities" class="mt-4" slot="action">
<Placeholder
icon={ArchiveBox}
title="No posts"
description="There are no posts that match this filter."
>
<Button href="/communities">
<Icon src={Plus} size="16" mini slot="icon" />
<span>Follow some communities</span>
</Button>
@@ -24,6 +24,7 @@
export let label: string | undefined = undefined
export let previewButton: boolean = false
export let disabled: boolean = false
export let rows: number = 4
export let beforePreview: (input: string) => string = (input) => input
@@ -241,6 +242,7 @@ overflow-hidden focus-within:border-black focus-within:dark:border-white transit
}
}
}}
{rows}
{...$$restProps}
/>
{/if}
+22 -11
View File
@@ -1,18 +1,29 @@
<script lang="ts">
import { Icon, type IconSource } from 'svelte-hero-icons'
export let icon: IconSource | undefined = undefined
export let title: string
export let description: string | undefined = undefined
</script>
<div
class="text-slate-600 dark:text-zinc-400 flex flex-col justify-center items-center gap-1"
class="text-slate-700 dark:text-zinc-300 flex flex-col justify-center items-center gap-2"
>
{#if $$slots.icon}
{#if icon}
<div
class="bg-slate-100 border border-slate-200 dark:border-zinc-700 dark:bg-zinc-800 p-3 rounded-full"
class="border border-slate-200 dark:border-zinc-700 dark:bg-zinc-800 p-3 rounded-full"
>
<slot name="icon" />
<Icon src={icon} size="28" />
</div>
{/if}
{#if $$slots.title}
<h1 class="font-bold text-lg"><slot name="title" /></h1>
{/if}
{#if $$slots.description}
<p class="text-sm text-center"><slot name="description" /></p>
{/if}
<slot name="action" />
<div class="flex flex-col gap-1 text-center">
<h1 class="text-slate-900 dark:text-zinc-100 text-lg font-medium">
{title}
</h1>
{#if description}
<p class="text-sm text-center font-normal">{description}</p>
{/if}
</div>
<slot />
</div>