feat: add TextProps component for reusable text modifications

This commit is contained in:
Xylight committed 2024-09-08 17:23:29 -07:00
1 parent 21ae0f8272
commit 848992175b
6 files changed
+61 -53

No files matched your search

+4 -3
View File
@@ -79,10 +79,11 @@
{/if}
</div>
{#if bio}
<div class="relative {center ? 'text-center' : 'text-left'}">
<div class="relative w-full {center ? 'text-center' : 'text-left'}">
<div
class="p-4 relative bg-white/30 dark:bg-zinc-900/30 border border-slate-300 dark:border-zinc-800 border-opacity-50
rounded-xl"
class="p-4 relative bg-white/30 dark:bg-zinc-900/30 border border-slate-300
dark:border-zinc-800 border-opacity-50 rounded-xl
max-w-full w-full"
>
<PostBody class="text-sm" view="list" body={bio} clickThrough />
</div>
+5 -2
View File
@@ -3,6 +3,7 @@
import { Icon, XMark } from 'svelte-hero-icons'
import { expoOut } from 'svelte/easing'
import { fly, slide } from 'svelte/transition'
import TextProps from '../text/TextProps.svelte'
type T = $$Generic
@@ -49,12 +50,14 @@
filters = filters
}}
color={filters.has(identifier) ? 'primary' : 'ghost'}
class="text-inherit dark:text-inherit text-xs px-2.5"
class="text-xs px-2.5"
rounding="pill"
size="sm"
>
<slot name="identifier" string={identifier}>
{identifier}
<TextProps wrap="no-wrap">
{identifier}
</TextProps>
</slot>
</Button>
{/each}
@@ -0,0 +1,16 @@
<script lang="ts" context="module">
const wrapClass = {
wrap: '',
'no-wrap': 'overflow-hidden overflow-ellipsis whitespace-nowrap',
}
</script>
<script lang="ts">
export let wrap: keyof typeof wrapClass = 'wrap'
$: classes = `${wrapClass[wrap]} ${$$props.class ?? ''}`
</script>
<span class={classes}>
<slot />
</span>