~james/core

core/web/src/lib/components/profile/StringCardContent.svelte -rw-r--r-- 1.4 KiB
452f17b7 — james chore(import): snapshot james.dad.town/core at f70c71c7696a 15 hours ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<script lang="ts">
	import { stringHref } from "#lib/components/strings/urls.ts";
	import Separator from "#lib/components/ui/Separator.svelte";
	import { compactRelativeTime } from "#lib/format.ts";
	import type { StringCardData } from "#lib/components/profile/types.ts";

	let { entry, layout = "card" }: { entry: StringCardData; layout?: "card" | "row" } = $props();
</script>

<div
	class={layout === "row"
		? "flex flex-col gap-2xs sm:flex-row sm:items-center sm:gap-md"
		: "flex min-h-24 flex-col justify-between gap-2xs"}
>
	<div class={layout === "row" ? "min-w-0 flex-1" : "flex flex-1 flex-col gap-xs"}>
		<div
			class="flex min-w-0 items-center justify-between pr-xs font-medium text-foreground-default"
			data-vt="move"
		>
			<a
				href={stringHref(entry.ownerHandle, entry.rkey)}
				class="min-w-0 truncate no-underline hover:underline"
			>
				{entry.filename}
			</a>
		</div>

		{#if layout === "card" && entry.description}
			<p
				data-vt="fade"
				class="line-clamp-2 pr-24 typography-paragraph-small text-foreground-muted"
			>
				{entry.description}
			</p>
		{/if}
	</div>

	<div
		class="flex flex-wrap items-center gap-2xs typography-monospace-small text-foreground-muted"
		data-vt="move"
	>
		{#if entry.sizeLabel}
			<span class="shrink-0">{entry.sizeLabel}</span>
			<Separator variant="dot" />
		{/if}
		<span>{compactRelativeTime(entry.createdAt)}</span>
	</div>
</div>