feat(react/settings): port max content width

This commit is contained in:
Elian Doran
2025-08-14 21:55:16 +03:00
parent 81ac390eab
commit 64bffb82b1
3 changed files with 38 additions and 48 deletions

View File

@@ -9,6 +9,15 @@ interface FormTextBoxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "
}
export default function FormTextBox({ inputRef, className, type, currentValue, onChange, ...rest}: FormTextBoxProps) {
if (type === "number" && currentValue) {
const { min, max } = rest;
if (min && currentValue < min) {
currentValue = String(min);
} else if (max && currentValue > max) {
currentValue = String(max);
}
}
return (
<input
ref={inputRef}