|
1 | | -// Shared utilities |
2 | | -// Import: #import "/utils/helpers.typ": * |
3 | | - |
4 | | - |
5 | 1 | #let hr = html.hr(class: "border-text/50 my-4") |
6 | | - |
7 | 2 | #let nav-link(href, label) = html.a( |
8 | 3 | class: "text-muted hover:text-accent transition-colors", |
9 | 4 | href: href, |
|
17 | 12 | } |
18 | 13 | #body |
19 | 14 | ] |
20 | | -// Helper for flex rows. |
21 | | -// We use a safelist comment to ensure Tailwind generates these classes. |
| 15 | + |
22 | 16 | // safelist: gap-1 gap-2 gap-3 gap-4 gap-5 gap-6 gap-8 |
23 | 17 | #let flex-row(gap: "4", ..items) = html.div( |
24 | 18 | class: "flex flex-wrap gap-" + gap + " items-center", |
25 | 19 | )[#for item in items.pos() { item }] |
26 | 20 |
|
27 | 21 | #let to-string(value) = repr(value) |
28 | 22 |
|
29 | | -// ---------------------------------------------------------------------------- |
30 | | -// Post Helpers |
31 | | -// ---------------------------------------------------------------------------- |
32 | | - |
33 | | -// Helper to fetching posts from the virtual JSON file |
34 | | -// - Filters for pages with "/posts/" anywhere in URL (supports path_prefix) |
35 | | -// - Excludes drafts |
36 | | -// - Sorts by date (newest first) |
37 | | - |
38 | 23 | // Helper to render a consistent post card |
39 | 24 | // - post: The post object from get-posts() |
40 | 25 | #let post-card(post) = { |
41 | 26 | let date = post.at("date", default: "") |
42 | 27 | // Cleaner approach: Wrap the whole card in a block-level anchor tag. |
43 | 28 | // HTML5 allows block elements (div, h3, p) inside anchor tags. |
44 | 29 | html.a( |
45 | | - class: "block mb-6 p-4 border border-white/10 rounded-lg bg-surface/50 hover:bg-surface transition-colors no-underline group", |
| 30 | + class: "block mb-6 p-4 border border-white/10 rounded-lg bg-surface/50 hover:bg-surface transition-colors no-underline group w-full", |
46 | 31 | href: post.url, |
47 | 32 | )[ |
48 | 33 | #html.h3( |
|
0 commit comments