flotilla/src/app/components/PinboardItem.svelte

44 lines
1.4 KiB
Svelte
Raw Normal View History

2026-06-23 23:30:54 +00:00
<script lang="ts">
2026-08-14 23:06:17 +00:00
import cx from "classnames"
2026-07-28 16:16:26 +00:00
import type {PinboardReader} from "@welshman/domain"
2026-08-14 23:06:17 +00:00
import Button from "@lib/components/Button.svelte"
import MenuButton from "@lib/components/MenuButton.svelte"
import BoardMenu from "@app/components/BoardMenu.svelte"
import UnreadDot from "@app/components/UnreadDot.svelte"
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-08-14 23:06:17 +00:00
selected: boolean
onclick: () => void
2026-06-23 23:30:54 +00:00
}
2026-08-14 23:06:17 +00:00
const {url, board, selected, onclick}: Props = $props()
const path = $derived(makeLibraryPath(url, board.address()))
2026-06-23 23:30:54 +00:00
</script>
2026-08-14 23:06:17 +00:00
<div class="relative w-56 shrink-0">
<Button
{onclick}
aria-pressed={selected}
class={cx("card card-sm card-interactive flex h-full w-full flex-col items-start gap-1 pr-10", {
"card-primary": selected,
})}>
<strong class="truncate w-full text-left"
><UnreadDot {path} class="mr-1" />{board.title() || "Untitled shelf"}</strong>
2026-08-14 23:06:17 +00:00
{#if board.description()}
<span class="line-clamp-2 text-left text-sm opacity-70">{board.description()}</span>
{/if}
</Button>
<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>
2026-06-23 23:30:54 +00:00
</div>