Open this example in the interactive library
Live preview
Source code
// components/ReamPurchaseEstimate.tsx
export default function ReamPurchaseEstimate({
pages = 28,
copies = 50,
}: { pages?: number; copies?: number } = {}) {
const sheets = Math.ceil(pages / 2) * copies;
return (
<dl>
<dt>500-sheet reams</dt>
<dd>{Math.ceil(sheets / 500)}</dd>
<dt>Unused sheets</dt>
<dd>{Math.ceil(sheets / 500) * 500 - sheets}</dd>
</dl>
);
}
