---
import { blog } from '../../lib/data';
import {
categoryCounts,
categoryUrl,
featuredPosts,
postUrl,
tagCounts,
tagUrl,
type Post,
} from '../../lib/posts';
import SearchBox from './SearchBox.astro';
import { Icon } from 'astro-icon/components';
export interface Props {
/** All published posts (not just the current page). */
posts: Post[];
/** Highlights the current category in the list. */
activeCategory?: string;
activeTag?: string;
}
const { posts, activeCategory, activeTag } = Astro.props;
const cats = categoryCounts(posts);
const featured = featuredPosts(posts);
const tags = tagCounts(posts);
const max = Math.max(1, ...tags.map((t) => t.count));
// 4 size steps by relative frequency.
const tagSize = (count: number) =>
['text-sm', 'text-base', 'text-lg', 'text-xl'][Math.min(3, Math.floor((count / max) * 3.999))];
const box = 'border-line bg-surface border p-5';
const title = 'font-display mb-4 flex items-center gap-3 text-sm font-bold tracking-wide uppercase';
---