diff --git a/web/components/number-input.tsx b/web/components/number-input.tsx new file mode 100644 index 00000000..e2d1ca5f --- /dev/null +++ b/web/components/number-input.tsx @@ -0,0 +1,62 @@ +import clsx from 'clsx' +import _ from 'lodash' + +import { Col } from './layout/col' +import { Spacer } from './layout/spacer' + +export function NumberInput(props: { + numberString: string + onChange: (newNumberString: string) => void + error: string | undefined + label: string + disabled?: boolean + className?: string + inputClassName?: string + // Needed to focus the amount input + inputRef?: React.MutableRefObject + children?: any +}) { + const { + numberString, + onChange, + error, + label, + disabled, + className, + inputClassName, + inputRef, + children, + } = props + + return ( + + + + + + {error && ( +
+ {error} +
+ )} + + {children} + + ) +}