import type { CookieTableRow } from './getConsentTexts.js' import type { ConsentTexts } from './texts.js' export type CookieTableLabels = { category: string duration: string name: string provider: string purpose: string } type CookieTableProps = { /** Optional caption above the table. */ caption?: string /** Category names — pass `texts.categories` from getConsentTexts so they match the banner. */ categories?: ConsentTexts['categories'] /** Classes per element; nothing is styled by default. */ classNames?: Partial> /** Column headings in the page's language — from the project (panel field or page content). */ labels: CookieTableLabels /** From getCookieTable({ payload, locale }) — Cookie Settings → Cookies. */ rows: CookieTableRow[] } /** * The cookie list for the cookie-policy page, straight from the panel — no copy * pasted into the policy text, so it can't go stale. Plain semantic , * unstyled: classNames per element, or style it from the page's CSS. Server * component (no state). * * const rows = await getCookieTable({ payload, locale }) * */ export function CookieTable({ caption, categories, classNames = {}, labels, rows }: CookieTableProps) { if (rows.length === 0) {return null} return (
{caption ? : null} {rows.map((row) => ( ))}
{caption}
{labels.name} {labels.provider} {labels.category} {labels.purpose} {labels.duration}
{row.name} {row.provider ?? ''} {categories?.[row.category]?.title ?? row.category} {row.purpose ?? ''} {row.duration ?? ''}
) }