43 lines
1.4 KiB
JavaScript
43 lines
1.4 KiB
JavaScript
// Morceaux de mise en page communs aux écrans.
|
|
|
|
import { h } from "./dom.js";
|
|
|
|
/**
|
|
* En-tête d'écran : surtitre, titre en capitales condensées, sous-titre.
|
|
* @param {{kicker?: string, title: string, sub?: string|null, back?: {label: string, onClick: () => void}}} o
|
|
*/
|
|
export function screenHeader({ kicker, title, sub, back }) {
|
|
return h("header", { class: "screen-head" },
|
|
back && h("button", { type: "button", class: "back", on: { click: back.onClick } },
|
|
h("span", { "aria-hidden": "true" }, "← "), back.label),
|
|
kicker && h("p", { class: "kicker" }, kicker),
|
|
h("h1", { class: "title" }, title),
|
|
sub && h("p", { class: "lede" }, sub));
|
|
}
|
|
|
|
/**
|
|
* Titre de section : un ruban adhésif.
|
|
* @param {string} text
|
|
* @param {string} [hint]
|
|
*/
|
|
export function sectionLabel(text, hint) {
|
|
return h("h2", { class: "tape" }, text, hint && h("span", { class: "tape__hint" }, hint));
|
|
}
|
|
|
|
/**
|
|
* Barre d'action collée en bas de l'écran, à portée de pouce.
|
|
* @param {...(Node|null|false)} children
|
|
*/
|
|
export function actionBar(...children) {
|
|
return h("div", { class: "action-bar" }, h("div", { class: "action-bar__in" }, ...children));
|
|
}
|
|
|
|
/**
|
|
* Petite carte de texte (cardio, repères).
|
|
* @param {string} title
|
|
* @param {string} text
|
|
*/
|
|
export function note(title, text) {
|
|
return h("article", { class: "note" }, h("h3", { class: "note__title" }, title), h("p", { class: "note__text" }, text));
|
|
}
|