"use client"; import { Field } from "@azmr/ui/field"; import { InputGroup, InputGroupAddon } from "@azmr/ui/input-group"; import { MoneyField, NumberField } from "@azmr/ui/number-field"; import { useState } from "react"; const GST = 0.15; const nzd = new Intl.NumberFormat("en-NZ", { style: "currency", currency: "NZD" }); export default function NumberFieldMoney() { const [rate, setRate] = useState(95); const [hours, setHours] = useState(7.5); const subtotal = (rate ?? 0) * (hours ?? 0); return (
hours
Subtotal
{nzd.format(subtotal)}
GST (15%)
{nzd.format(subtotal * GST)}
Total
{nzd.format(subtotal * (1 + GST))}
); }