Jafacak.es design system
Every piece of the site's UI is a component in ui/components/. Each one is a
Python class with a co-located template (.html) and stylesheet (.css), and
is used in templates as a tag:
{% load design_components %}
{% post_card page=page %}
{% post_card title=item.title url=item.url date=item.published_at %}
Components that show a page (post_card, article_header) take it directly
with page= and fill their other params from it; anything passed explicitly
wins. pagination likewise takes a paginator page with page_obj=. The
custom param types live in ui/params.py.
Styling belongs to the components. jafacakes/src/jafacakes.css only holds
the shared tokens below (colour, type, spacing, widths) and a minimal page
reset: the html/body background and base font, responsive images and the
focus outline. Components use the tokens rather than raw sizes or colours, so
the scale and palette can change in one place.
Page structure is built from components too: page_main wraps every page,
card_grid lays out the homepage and portfolio cards, article_body holds an article's blocks
at the reading measure and rich_text styles prose from the editor.
Type scale
The root font size is the browser default (16px), so 1rem is 16px and
respects the reader's own font-size setting. Sizes marked fluid grow with the
viewport between the two values shown.
| Token | Size | Used for |
|---|---|---|
--jc-text-xs |
14px | Code block language caption |
--jc-text-sm |
15px | Dates on cards |
--jc-text-code |
15px | Code and terminal text |
--jc-text-base |
17 → 18px, fluid | Body copy and the article date (card descriptions use a fixed 16px) |
--jc-text-lg |
20 → 22px, fluid | Card titles, h4 |
--jc-text-h3 |
22 → 26px, fluid | Article h3 |
--jc-text-h2 |
26 → 34px, fluid | Article h2 |
--jc-text-display |
32 → 48px, fluid | Article title (h1) |
--jc-text-logo |
28 → 36px, fluid | Site wordmark |
The article title is always the largest text on the page, then h2, then
h3, so headings never outrank the title.
Spacing
--jc-space-1 to --jc-space-10 step through 4, 8, 12, 16, 20, 24, 32, 40,
48 and 64px. --jc-gutter is the page's side padding: 16px on phones rising
to 32px on wide screens.
Layout widths
--jc-shell-width(1440px): header and homepage card grid.--jc-max-width(760px): article text, about 70 characters a line.
Colour
Colours come from the Jaffa palette tokens (--jc-bg, --jc-text,
--jc-accent, …) at the top of jafacakes.css. Syntax highlighting lives in
code_block.css and uses the --jc-code-* tokens; terminal_line loads the
same file.