// maths-brevet-helpers.jsx
// Math-specific reusable building blocks for the Brevet pack.
// All composed on top of locked V1.2 blocks. No page chrome — these are
// inner components that go *inside* PageShell / Box / ExerciseCard.
const MB_F = React.Fragment;
/* ────────────────────────────────────────────────
MathExpr — display math (lightweight, print-safe)
──────────────────────────────────────────────── */
function MathExpr({ children, size = "0.16in", display = false }) {
return (
{children}
);
}
// Fraction (numerator over denominator) — rendered with stacked divs
function Frac({ num, den, size = "0.14in" }) {
return (
{num}{den}
);
}
// Square root
function Sqrt({ children, size = "0.14in" }) {
return (
√{children}
);
}
// Power
function Pow({ base, exp, size = "0.14in" }) {
return (
{base}
{exp}
);
}
/* ────────────────────────────────────────────────
StepBlock — aligned calculation steps
« = 3x + 12 — 5 » with leading "=" indented
──────────────────────────────────────────────── */
function StepBlock({ steps = [], hint, tone = "neutral" }) {
const bg = tone === "cool" ? "var(--ae-primary-soft)" : "white";
return (
{steps.map((s, i) => (
{i === 0 ? "" : "="}{s.expr}
{s.note && {s.note}}
))}
{hint &&
{hint}
}
);
}
/* ────────────────────────────────────────────────
GridCalc — grid of small calc cells
──────────────────────────────────────────────── */
function GridCalc({ items = [], cols = 3, withResult = true }) {
return (
{items.map((it, i) => (
{i + 1}{it} {withResult && = }
{withResult && }
))}
);
}
/* ────────────────────────────────────────────────
QCMRow — single MCQ question with A/B/C
──────────────────────────────────────────────── */
function QCMRow({ n, q, options = [] }) {
return (