Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

AutoSettleDaysField.tsx

23 lines690 Bytes

1import {
2 MAX_SIDEBAR_AUTO_SETTLE_AFTER_DAYS,
3 MIN_SIDEBAR_AUTO_SETTLE_AFTER_DAYS,
4} from "@t3tools/contracts";
5import type { ComponentProps } from "react";
6import { NumberField } from "../../../components/ui/NumberField";
7​
8export type AutoSettleDaysFieldProps = Pick<
9 ComponentProps<typeof NumberField>,
10 "value" | "onValueChange" | "disabled"
11>;
12​
13export function AutoSettleDaysField(props: AutoSettleDaysFieldProps) {
14 return (
15 <NumberField
16 {...props}
17 min={MIN_SIDEBAR_AUTO_SETTLE_AFTER_DAYS}
18 max={MAX_SIDEBAR_AUTO_SETTLE_AFTER_DAYS}
19 label="Days before auto-settle"
20 formatValue={(value) => `${value} ${value === 1 ? "day" : "days"}`}
21 />
22 );