website

source code for the ttmaths.uk website
Log | Files | Refs | README

commit ed1c3fe4536fdfd4c7bd3f5f317da3cd27841afb
parent c74bc9dbe7fc1172937b21e39bdfe3360b114bed
Author: hrryt <harry@mayesfield.uk>
Date:   Sat,  8 Aug 2026 19:11:13 +0100

Allow non-equation components to questions

Diffstat:
Msrc/components/Question.jsx | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/components/Question.jsx b/src/components/Question.jsx @@ -1,9 +1,14 @@ import Equation from './Equation.jsx'; +function maybeEquation(expression) { + if (typeof expression == 'string') { return <Equation equation={expression} />; } + return expression; +} + export default function Question({ question, answer, showAnswer }) { return ( <li> - <Equation equation={showAnswer ? answer : question} /> + {maybeEquation(showAnswer ? answer : question)} </li> ); }