import { BlogCategoryOption, BlogGridBaseProps } from "./types"; import { Pagination } from "@shared/components/pagination"; import { Select } from "@shared/components/select"; import { Text } from "@shared/components/text"; import { BlogCard } from "@shared/contentful/blocks/cards/blog-card"; export function BlogGridBase({ title = "recent articles", description, paginatedArticles, totalArticles, currentPage, totalPages, selectedCategory, categoryOptions, onCategoryChange, onPageChange, getPageHref, asList = false, imageComponent, }: BlogGridBaseProps) { function handleCategoryChange(value: unknown) { if (!value || Array.isArray(value)) return; const cat = value as BlogCategoryOption; onCategoryChange?.(cat); } function handlePageChange(page: number) { onPageChange?.(page); } return (
{/* Controls bar */}
{description && ( {description} )} {title} {categoryOptions.length > 0 && (
{/* Showing count */} showing showing{" "} {paginatedArticles.length} of {totalArticles} articles {/* Filter dropdown */}