Skip to content

Commit 9bc30fb

Browse files
committed
feat: update NewPostsToast component with improved styling and layout
1 parent c8a528e commit 9bc30fb

1 file changed

Lines changed: 21 additions & 20 deletions

File tree

src/lib/components/newsroom/NewPostsToast.svelte

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
import { clientLocale } from "$lib/hooks/client-locale.svelte";
44
import TypeBadge from "$src/lib/components/newsroom/TypeBadge.svelte";
55
import type { Post } from "$types";
6+
import { Badge } from "$ui/badge";
7+
import { Button } from "$ui/button";
68
import ImageIcon from "@lucide/svelte/icons/image";
79
import Newspaper from "@lucide/svelte/icons/newspaper";
8-
import { Avatar, Button } from "bits-ui";
10+
import { Avatar } from "bits-ui";
911
1012
interface Props {
1113
posts: Post[];
@@ -37,47 +39,46 @@
3739
}
3840
</script>
3941

40-
<section role="status" aria-live="polite" class="flex w-full max-w-sm flex-col gap-3 rounded-lg px-4 py-3 text-text shadow-lg shadow-black/10 glass glass-brightness-150 dark:glass-brightness-50 glass-contrast-60 dark:glass-contrast-100 @container-normal @sm:max-w-md">
42+
<section role="status" aria-live="polite" class="flex w-full max-w-sm flex-col gap-3 px-4 py-3 text-foreground shadow-lg shadow-black/10 @container-normal @sm:max-w-md">
4143
<div class="flex flex-col min-w-0 items-start gap-3">
4244
{#if thumb && newestUnseen.heroImage}
43-
<Avatar.Root class="relative aspect-video w-full max-w-sm mx-auto shrink-0 overflow-hidden rounded-lg bg-background-lore">
45+
<Avatar.Root class="relative aspect-video w-full max-w-sm mx-auto shrink-0 overflow-hidden rounded-xl border">
4446
<Avatar.Image src={thumb.url} alt={newestUnseen.heroImage.alt ?? ""} width={thumb.width} height={thumb.height} loading="lazy" class="size-full object-cover" />
45-
<Avatar.Fallback class="flex size-full items-center justify-center bg-text/10">
47+
<Avatar.Fallback class="flex size-full items-center justify-center bg-foretext-foreground/10">
4648
<ImageIcon class="size-5" aria-label="Image failed to load" />
4749
</Avatar.Fallback>
4850
<div class="pointer-events-none absolute inset-0 bg-linear-to-t from-background/70 via-background/10 to-transparent group-hover:opacity-0 transition-opacity duration-300 ease-out"></div>
4951
</Avatar.Root>
5052
{:else}
51-
<div class="flex size-10 shrink-0 items-center justify-center rounded-lg bg-link/15 text-link">
53+
<div class="flex size-10 shrink-0 items-center justify-center rounded-xl bg-primary/15 text-primary">
5254
<Newspaper class="size-5" />
5355
</div>
5456
{/if}
55-
56-
<div class="min-w-0 flex-1 space-y-1">
57-
<p class="text-lg lg:text-xl leading-tight font-bold text-text">{newestUnseen.title}</p>
58-
{#if newestUnseen.excerpt}
59-
<p class="line-clamp-3 text-sm leading-relaxed text-text/80">{newestUnseen.excerpt}</p>
60-
{/if}
61-
{#if publishedDate}
62-
<time datetime={newestUnseen.publishedAt ?? undefined} class="shrink-0 text-xs font-medium text-text/60">{publishedDate}</time>
63-
{/if}
64-
</div>
65-
6657
<div class="mt-auto flex flex-wrap items-center gap-1.5 pt-1">
6758
<TypeBadge type={newestUnseen.type} />
6859
{#each visibleTags as tag (tag)}
69-
<span class="rounded-full bg-text/10 px-2 py-0.5 text-[10px] font-medium text-text/70">#{tag}</span>
60+
<Badge variant="outline">#{tag}</Badge>
7061
{/each}
7162
{#if overflowTags > 0}
72-
<span class="rounded-full bg-text/10 px-2 py-0.5 text-[10px] font-medium text-text/50">+{overflowTags}</span>
63+
<Badge variant="outline">+{overflowTags}</Badge>
64+
{/if}
65+
</div>
66+
67+
<div class="min-w-0 flex-1 space-y-1">
68+
<p class="text-lg lg:text-xl leading-tight font-bold text-foreground">{newestUnseen.title}</p>
69+
{#if newestUnseen.excerpt}
70+
<p class="line-clamp-3 text-sm leading-relaxed text-foreground/80">{newestUnseen.excerpt}</p>
71+
{/if}
72+
{#if publishedDate}
73+
<time datetime={newestUnseen.publishedAt ?? undefined} class="shrink-0 text-xs font-medium text-muted-foreground">{publishedDate}</time>
7374
{/if}
7475
</div>
7576
</div>
7677

7778
<div class="flex items-center justify-end gap-2">
78-
<Button.Root aria-label="Dismiss newsroom notifications" class="rounded-lg px-3 py-1.5 text-sm font-bold transition-colors hover:text-hover text-text/70" onclick={dismiss}>Close</Button.Root>
79+
<Button aria-label="Dismiss newsroom notifications" onclick={dismiss} variant="outline">Close</Button>
7980
{#if newestUnseen.slug}
80-
<Button.Root href="/newsroom/{newestUnseen.slug}" data-sveltekit-preload-data="hover" class="rounded-lg bg-link px-3 py-1.5 text-sm font-bold text-background transition-colors hover:bg-hover" onclick={dismiss}>Read</Button.Root>
81+
<Button href="/newsroom/{newestUnseen.slug}" data-sveltekit-preload-data="hover" onclick={dismiss}>Read</Button>
8182
{/if}
8283
</div>
8384
</section>

0 commit comments

Comments
 (0)