후보지 입력칸 별도의 폼영역 생성완료, 라벨 변수화

This commit is contained in:
YangJinSoo94
2025-05-27 18:03:39 +09:00
parent bc75831da2
commit beb00412c1
@@ -1,6 +1,9 @@
import React, { useCallback, useState } from "react";
import { FormControl, FormItem, FormLabel, FormMessage } from "../form";
import { Checkbox } from "@common/components/ui";
import { Button, Checkbox } from "@common/components/ui";
export const BZNM_TOT_NO = '총사업자등록번호';
export const CANDIDATE = '공급처 후보지 선택(필수아님)';
interface FormUiProps extends React.HTMLAttributes<HTMLDivElement> {
label?: string;
@@ -20,11 +23,11 @@ const FormUi = React.forwardRef<HTMLDivElement, FormUiProps>(
setIsChecked(checked);
onCheckboxChange?.(checked);
}, [onCheckboxChange]);
console.log(children);
return (
<FormItem ref={ref}>
{label && <FormLabel className="text-xl">{label}</FormLabel>}
{label === '종사업자등록번호' && (
{label === BZNM_TOT_NO && (
<div className="float-right">
<div className="flex items-center gap-2">
<Checkbox
@@ -36,6 +39,12 @@ const FormUi = React.forwardRef<HTMLDivElement, FormUiProps>(
</div>
</div>
)}
{label === CANDIDATE && (
<FormControl>
{children}
</FormControl>
)}
{label !== BZNM_TOT_NO && label !== CANDIDATE && (
<FormControl>
{React.isValidElement(children) && isDisabled
? React.cloneElement(children, {
@@ -44,6 +53,7 @@ const FormUi = React.forwardRef<HTMLDivElement, FormUiProps>(
})
: children}
</FormControl>
)}
<FormMessage />
</FormItem>
);