refactor: number 타입 인풋 onChange 방식 변경

This commit is contained in:
2025-05-29 13:35:12 +09:00
parent 7265d90c8c
commit 44ffb0e0e4
4 changed files with 24 additions and 44 deletions
+6 -14
View File
@@ -189,13 +189,9 @@ function BbsForm({ form, bbsId, ...props }: BbsFormProps) {
type="number"
min={0}
value={boardTemplate?.atflMaxCnt ?? field.value ?? ""}
onChange={(e) => {
const value = e.target.value;
if (isNaN(parseInt(value))) return;
field.onChange(
value === "" ? null : parseInt(value),
);
}}
onChange={(e) =>
field.onChange(parseInt(e.target.value))
}
className="w-[12rem] !text-[1.3rem]"
placeholder="최대 개수 입력"
disabled={
@@ -224,13 +220,9 @@ function BbsForm({ form, bbsId, ...props }: BbsFormProps) {
value={
boardTemplate?.atflMaxFileSz ?? field.value ?? ""
}
onChange={(e) => {
const value = e.target.value;
if (isNaN(parseInt(value))) return;
field.onChange(
value === "" ? null : parseInt(value),
);
}}
onChange={(e) =>
field.onChange(parseInt(e.target.value))
}
className="w-[12rem] !text-[1.3rem]"
placeholder="최대 크기 입력"
disabled={
+3 -5
View File
@@ -124,11 +124,9 @@ function ImageForm({ form, imgSn, ...props }: ImageFormProps) {
type="number"
min={0}
value={field.value ?? ""}
onChange={(e) => {
const value = e.target.value;
if (isNaN(parseInt(value))) return;
field.onChange(parseInt(value));
}}
onChange={(e) =>
field.onChange(parseInt(e.target.value))
}
className="w-[12rem] !text-[1.3rem]"
placeholder="정렬순서 입력"
/>
+3 -5
View File
@@ -113,11 +113,9 @@ function ModuleForm({ form, authorizationNo, ...props }: BannerFormProps) {
type="number"
min={0}
value={field.value ?? ""}
onChange={(e) => {
const value = e.target.value;
if (isNaN(parseInt(value))) return;
field.onChange(parseInt(value));
}}
onChange={(e) =>
field.onChange(parseInt(e.target.value))
}
className="w-[12rem] !text-[1.3rem]"
placeholder="정렬순서 입력"
/>
+12 -20
View File
@@ -116,11 +116,9 @@ function PopupForm<T extends PopupFormData | PopupUpdateFormData>({
value={field.value ?? 0}
className="w-[10rem] !text-[1.3rem]"
placeholder="너비"
onChange={(e) => {
const value = e.target.value;
if (isNaN(parseInt(value))) return;
field.onChange(parseInt(value));
}}
onChange={(e) =>
field.onChange(parseInt(e.target.value))
}
/>
</FormControl>
</FormItem>
@@ -139,11 +137,9 @@ function PopupForm<T extends PopupFormData | PopupUpdateFormData>({
value={field.value ?? 0}
className="w-[10rem] !text-[1.3rem]"
placeholder="높이"
onChange={(e) => {
const value = e.target.value;
if (isNaN(parseInt(value))) return;
field.onChange(parseInt(value));
}}
onChange={(e) =>
field.onChange(parseInt(e.target.value))
}
/>
</FormControl>
</FormItem>
@@ -168,11 +164,9 @@ function PopupForm<T extends PopupFormData | PopupUpdateFormData>({
value={field.value ?? 0}
className="w-[10rem] !text-[1.3rem]"
placeholder="Left"
onChange={(e) => {
const value = e.target.value;
if (isNaN(parseInt(value))) return;
field.onChange(parseInt(value));
}}
onChange={(e) =>
field.onChange(parseInt(e.target.value))
}
/>
</FormControl>
</FormItem>
@@ -191,11 +185,9 @@ function PopupForm<T extends PopupFormData | PopupUpdateFormData>({
value={field.value ?? 0}
className="w-[10rem] !text-[1.3rem]"
placeholder="Top"
onChange={(e) => {
const value = e.target.value;
if (isNaN(parseInt(value))) return;
field.onChange(parseInt(value));
}}
onChange={(e) =>
field.onChange(parseInt(e.target.value))
}
/>
</FormControl>
</FormItem>