"use client"; import React, { useState } from "react"; import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter, DialogDescription, } from "@/components/ui/dialog"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Textarea } from "@/components/ui/textarea"; import { Checkbox } from "@/components/ui/checkbox"; import { TableCategoryValue } from "@/types/tableCategoryValue"; interface CategoryValueAddDialogProps { open: boolean; onOpenChange: (open: boolean) => void; onAdd: (value: TableCategoryValue) => void; columnLabel: string; } export const CategoryValueAddDialog: React.FC< CategoryValueAddDialogProps > = ({ open, onOpenChange, onAdd, columnLabel }) => { const [valueCode, setValueCode] = useState(""); const [valueLabel, setValueLabel] = useState(""); const [description, setDescription] = useState(""); const [color, setColor] = useState("#3b82f6"); const [isDefault, setIsDefault] = useState(false); const handleSubmit = () => { if (!valueCode || !valueLabel) { return; } onAdd({ tableName: "", columnName: "", valueCode: valueCode.toUpperCase(), valueLabel, description, color, isDefault, }); // 초기화 setValueCode(""); setValueLabel(""); setDescription(""); setColor("#3b82f6"); setIsDefault(false); }; return ( 새 카테고리 값 추가 {columnLabel}에 새로운 값을 추가합니다
setValueCode(e.target.value.toUpperCase())} className="h-8 text-xs sm:h-10 sm:text-sm" />

영문 대문자와 언더스코어만 사용 (DB 저장값)

setValueLabel(e.target.value)} className="h-8 text-xs sm:h-10 sm:text-sm" />

사용자에게 표시될 이름