|
3 | 3 | import { clientLocale } from "$lib/hooks/client-locale.svelte"; |
4 | 4 | import TypeBadge from "$src/lib/components/newsroom/TypeBadge.svelte"; |
5 | 5 | import type { Post } from "$types"; |
| 6 | + import { Badge } from "$ui/badge"; |
| 7 | + import { Button } from "$ui/button"; |
6 | 8 | import ImageIcon from "@lucide/svelte/icons/image"; |
7 | 9 | import Newspaper from "@lucide/svelte/icons/newspaper"; |
8 | | - import { Avatar, Button } from "bits-ui"; |
| 10 | + import { Avatar } from "bits-ui"; |
9 | 11 |
|
10 | 12 | interface Props { |
11 | 13 | posts: Post[]; |
|
37 | 39 | } |
38 | 40 | </script> |
39 | 41 |
|
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"> |
41 | 43 | <div class="flex flex-col min-w-0 items-start gap-3"> |
42 | 44 | {#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"> |
44 | 46 | <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"> |
46 | 48 | <ImageIcon class="size-5" aria-label="Image failed to load" /> |
47 | 49 | </Avatar.Fallback> |
48 | 50 | <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> |
49 | 51 | </Avatar.Root> |
50 | 52 | {: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"> |
52 | 54 | <Newspaper class="size-5" /> |
53 | 55 | </div> |
54 | 56 | {/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 | | - |
66 | 57 | <div class="mt-auto flex flex-wrap items-center gap-1.5 pt-1"> |
67 | 58 | <TypeBadge type={newestUnseen.type} /> |
68 | 59 | {#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> |
70 | 61 | {/each} |
71 | 62 | {#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> |
73 | 74 | {/if} |
74 | 75 | </div> |
75 | 76 | </div> |
76 | 77 |
|
77 | 78 | <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> |
79 | 80 | {#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> |
81 | 82 | {/if} |
82 | 83 | </div> |
83 | 84 | </section> |
0 commit comments