Files
edbridge-scholars/src/components/Math.tsx
2026-03-01 20:24:14 +06:00

26 lines
624 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React from "react";
/**
* Renders a proper stacked fraction with numerator above denominator.
* Usage: <Frac n="x² 1" d="x² 2x + 1" />
*/
export const Frac = ({ n, d }: { n: React.ReactNode; d: React.ReactNode }) => (
<span
style={{
display: "inline-flex",
flexDirection: "column",
alignItems: "center",
verticalAlign: "middle",
lineHeight: 1.25,
margin: "0 3px",
}}
>
<span
style={{ borderBottom: "1.5px solid currentColor", padding: "0 4px 2px" }}
>
{n}
</span>
<span style={{ padding: "2px 4px 0" }}>{d}</span>
</span>
);