flotilla/src/app/components/PinboardItem.svelte

47 lines
1.5 KiB
Svelte
Raw Normal View History

2026-06-23 23:30:54 +00:00
<script lang="ts">
2026-07-28 16:16:26 +00:00
import {Pins} from "@welshman/app"
import type {PinboardReader} from "@welshman/domain"
2026-06-23 23:30:54 +00:00
import AltArrowRight from "@assets/icons/alt-arrow-right.svg?dataurl"
import Icon from "@lib/components/Icon.svelte"
import Link from "@lib/components/Link.svelte"
import MenuButton from "@lib/components/MenuButton.svelte"
import PinItem from "@app/components/PinItem.svelte"
import BoardMenu from "@app/components/BoardMenu.svelte"
2026-07-28 16:16:26 +00:00
import {app} from "@app/core"
import {makeLibraryPath} from "@app/routes"
2026-06-23 23:30:54 +00:00
type Props = {
url: string
2026-07-28 16:16:26 +00:00
board: PinboardReader
2026-06-23 23:30:54 +00:00
}
const {url, board}: Props = $props()
2026-07-28 16:16:26 +00:00
const pins = $app.use(Pins).forBoard(board.address()).$
const detailPath = makeLibraryPath(url, board.address())
2026-06-23 23:30:54 +00:00
</script>
<div class="card relative flex flex-col gap-2">
<div class="absolute right-2 top-2 z-feature">
<MenuButton
class="button button-neutral button-sm button-square"
aria-label="More options"
iconSize={4}
component={BoardMenu}
componentProps={{url, board}} />
</div>
<div class="flex flex-col pr-8">
2026-07-28 16:16:26 +00:00
<strong class="text-lg">{board.title() || "Untitled shelf"}</strong>
{#if board.description()}
<span class="text-sm opacity-70">{board.description()}</span>
2026-06-23 23:30:54 +00:00
{/if}
</div>
2026-07-28 16:16:26 +00:00
{#each $pins.slice(0, 1) as pin (pin.id())}
<PinItem minimal {url} {pin} />
2026-06-23 23:30:54 +00:00
{/each}
<Link href={detailPath} class="button button-primary">
<Icon icon={AltArrowRight} />
<strong>View all content</strong>
</Link>
</div>