Spaces:
Sleeping
Sleeping
File size: 896 Bytes
0e24aff | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | import { useEffect, useRef } from "react";
import { renderEquationInto } from "@/lib/format";
interface EquationDisplayProps {
equation: string;
rationale?: string;
className?: string;
}
export function EquationDisplay({
equation,
rationale,
className,
}: EquationDisplayProps): JSX.Element {
const targetRef = useRef<HTMLDivElement>(null);
useEffect(() => {
if (targetRef.current) {
renderEquationInto(targetRef.current, equation);
}
}, [equation]);
return (
<div className={className ?? "panel-muted"}>
<div className="heading-eyebrow mb-2">Current hypothesis</div>
<div ref={targetRef} className="min-h-[44px] text-textPrimary" />
{rationale ? (
<p className="mt-3 text-sm text-textMuted">
<span className="font-medium text-textPrimary">Rationale:</span> {rationale}
</p>
) : null}
</div>
);
}
|