TypeFeedPage

These templates include the full document shell. Each variant is shown in a separate frame (same URL as “open alone”).


src/ui/3_templates/TypeFeedPage.astro
---
import Base from './Base.astro'
import Heading from '../0_atoms/Heading.astro'
import PostFeedRow from '../2_organisms/PostFeedRow.astro'
import PaginationNav from '../2_organisms/PaginationNav.astro'
import type { FeedPost } from '../../lib/feed-types'
interface Props {
title: string
heading: string
posts: FeedPost[]
currentPage: number
totalPages: number
/** List root without trailing slash (e.g. `/notes`). */
basePath: string
/** Pass from page: `Astro.site ? new URL(Astro.url.pathname, Astro.site).href : undefined` */
canonicalHref?: string
}
const { title, heading, posts, currentPage, totalPages, basePath, canonicalHref } = Astro.props
let prevHref: string | null = null
if (currentPage > 1) {
prevHref = currentPage === 2 ? basePath : `${basePath}/page/${currentPage - 1}`
}
const nextHref = currentPage < totalPages ? `${basePath}/page/${currentPage + 1}` : null
---
<Base title={title} canonicalHref={canonicalHref}>
<Heading class="meta mt-0 mb-6 text-xl font-semibold text-ink">{heading}</Heading>
<ul class="list-none p-0 m-0 [&>li:last-child]:border-b-0">
{posts.map(post => <PostFeedRow post={post} />)}
</ul>
<PaginationNav totalPages={totalPages} prevHref={prevHref} nextHref={nextHref} />
</Base>