diff --git a/apps/wr/app/component/publicReuseInsertForm.tsx b/apps/wr/app/component/publicReuseInsertForm.tsx new file mode 100644 index 000000000..9853e39c6 --- /dev/null +++ b/apps/wr/app/component/publicReuseInsertForm.tsx @@ -0,0 +1,10 @@ +export function PublicReuseFaciltyInsert(){ + + + + return ( + <> + + + ); +} \ No newline at end of file diff --git a/apps/wr/app/publicReuseFaciltyInsert/page.tsx b/apps/wr/app/publicReuseFaciltyInsert/page.tsx index f5e565fd3..04cb3b088 100644 --- a/apps/wr/app/publicReuseFaciltyInsert/page.tsx +++ b/apps/wr/app/publicReuseFaciltyInsert/page.tsx @@ -1,16 +1,22 @@ -import {UiTable} from '@common/business_components'; -import { TableRow } from '@common/components'; +'use client' +import { zodResolver } from "@hookform/resolvers/zod" +import { useForm } from "react-hook-form" +import { z } from "zod" + +import {UiTable } from '@common/business_components'; +import {UiForm} from '@common/business_components'; +import { Input, TableRow } from '@common/components'; import { TableHead } from '@common/components'; - - +import { FormField, FormItem, FormLabel, FormControl, FormDescription, FormMessage } from "@common/business_components/ui/form/lib/form"; +import Style from "../style/PublicReuseFaciltyInsert.module.css"; interface TableUpperProps { id: string; - title: string; - upName : string; + title: string|undefined; + upName : string|undefined; upSequnce: number; } - +/* const publicReuseFacility = [ { sido: "서울", @@ -43,7 +49,7 @@ const publicReuseFacility = [ register: "Y" }, -] +]*/ const publicReuseFacilityUper = [ { @@ -80,7 +86,7 @@ const publicReuseFacilityUper = [ ] - + /* const headList = [ { id: "sido", title: "시도" }, { id: "sigungo", title: "시군구" }, @@ -91,42 +97,100 @@ const headList = [ { id: "reuse", title: '재이용여부' }, { id: "register", title: '등록여부' }]; - +*/ const upHeadList = [ - { id: "sido", title: "시도" }, - { id: "sigungo", title: "시군구" }, - { id: "facilityName", title: "시설명" }, - { id: "location", title: "위치" }, - { id: "locationgubun", title: "지역구분" }, - { id: "facilityCapacity", title: "시설용량" }, + { id: "sido", title: "시도" , upName:'no',upSequnce:1 }, + { id: "sigungo", title: "시군구" , upName:'no', upSequnce:1 }, + { id: "facilityName", title: "시설명" , upName:'no', upSequnce:1 }, + { id: "location", title: "위치" , upName:'no',upSequnce:1 }, + { id: "locationgubun", title: "지역구분" ,upName:'no', upSequnce:1 }, + { id: "facilityCapacity", title: "시설용량" , upName:'no',upSequnce:1 }, { id: "yn", title: '여부', upName:'upChangeRe' , upSequnce:1 }, { id: "authoDay", title: '허가일',upName:'upChangeRe', upSequnce:2 }, { id: "area", title: '면적' ,upName:'upChangeRe',upSequnce:3 }]; - const headMakeColSpan = (upHeadList: any) => { + const headMakeColSpan = (upHeadList: TableUpperProps[]) => { return ( <> { upHeadList.map((head: TableUpperProps) => - (head.upName === 'upChangeRe'&& head.upSequnce=== 1?{'중축 개축 증축 '}: + (head.upName === 'upChangeRe'&& head.upSequnce=== 1?{'중축 개축 증축 '}: head.upSequnce> 1?null:{head.title}))} {upHeadList.map((head: TableUpperProps) => (head.upName === 'upChangeRe'?{head.title}:null))} - ) + ) } + + + + + + export default function PublicReuseFaciltyInsert() { const nodeList= headMakeColSpan(upHeadList); const total = 100; - return (
- -
+ + const formSchema= z.object({ + username: z.string().min(2).max(50), +}) + +const form = useForm>({ + resolver: zodResolver(formSchema), + defaultValues: { + username: "", + }, +}) + + // 2. Define a submit handler. + function onSubmit(values: z.infer) { + // Do something with the form values. + // ✅ This will be type-safe and validated. + console.log(values) + } + const formField = ()=>{ + return( + ( + + Username + + + + + This is your public display name. + + + + )} + /> + ) } + + const makeFromField= formField(); + + + return ( <> +
+
+ + {nodeList} + +
+
+ + +
+
+ + ); } diff --git a/apps/wr/app/style/PublicReuseFaciltyInsert.module.css b/apps/wr/app/style/PublicReuseFaciltyInsert.module.css new file mode 100644 index 000000000..60940678b --- /dev/null +++ b/apps/wr/app/style/PublicReuseFaciltyInsert.module.css @@ -0,0 +1,10 @@ +.table{ + width: 50%; + float:left; +} + +.form{ + width: 50%; + display:flex; + margin-left:10px; +} \ No newline at end of file diff --git a/apps/wr/package.json b/apps/wr/package.json index 3d2738506..347537b32 100644 --- a/apps/wr/package.json +++ b/apps/wr/package.json @@ -11,7 +11,11 @@ "dependencies": { "@common/business_components": "workspace:*", "@common/components": "workspace:*", - "next": "15.1.7" + "next": "15.1.7", + "zod": "^3.24.2", + "@hookform/resolvers": "^4.1.3", + "react-hook-form": "^7.54.2" + }, "devDependencies": { "@eslint/eslintrc": "^3", diff --git a/packages/common/business_components/src/ui/form/index.tsx b/packages/common/business_components/src/ui/form/index.tsx index 4f8731d86..f7a468d59 100644 --- a/packages/common/business_components/src/ui/form/index.tsx +++ b/packages/common/business_components/src/ui/form/index.tsx @@ -1,8 +1,7 @@ -"use client" import { Button } from "@common/components" -import { Form } from "./form" +import { Form } from "./lib/form" interface UiFormProps { onSubmit: object @@ -28,7 +27,7 @@ import { Form } from "./form" )} />*/ -export default function UIForm(uiFormProps: UiFormProps) { +export function UiForm(uiFormProps: UiFormProps) { const {onSubmit, form, formField} = uiFormProps; return ( diff --git a/packages/common/business_components/src/ui/form/button.tsx b/packages/common/business_components/src/ui/form/lib/button.tsx similarity index 100% rename from packages/common/business_components/src/ui/form/button.tsx rename to packages/common/business_components/src/ui/form/lib/button.tsx diff --git a/packages/common/business_components/src/ui/form/form.tsx b/packages/common/business_components/src/ui/form/lib/form.tsx similarity index 98% rename from packages/common/business_components/src/ui/form/form.tsx rename to packages/common/business_components/src/ui/form/lib/form.tsx index cc63a6e7d..40924c6d5 100644 --- a/packages/common/business_components/src/ui/form/form.tsx +++ b/packages/common/business_components/src/ui/form/lib/form.tsx @@ -12,8 +12,8 @@ import { useFormContext, } from "react-hook-form" -import { cn } from "../../lib/utils" -import { Label } from "./label" +import { cn } from "../../../lib/utils" +import { Label } from "../lib/label" const Form = FormProvider diff --git a/packages/common/business_components/src/ui/form/label.tsx b/packages/common/business_components/src/ui/form/lib/label.tsx similarity index 94% rename from packages/common/business_components/src/ui/form/label.tsx rename to packages/common/business_components/src/ui/form/lib/label.tsx index b54156049..27fa05c70 100644 --- a/packages/common/business_components/src/ui/form/label.tsx +++ b/packages/common/business_components/src/ui/form/lib/label.tsx @@ -4,7 +4,7 @@ import * as LabelPrimitive from "@radix-ui/react-label" import { cva, type VariantProps } from "class-variance-authority" import * as React from "react" -import { cn } from "../../lib/utils" +import { cn } from "../../../lib/utils" const labelVariants = cva( "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70" diff --git a/packages/common/business_components/src/ui/form/test.tsx b/packages/common/business_components/src/ui/form/test.tsx index 377bf276d..024b78baa 100644 --- a/packages/common/business_components/src/ui/form/test.tsx +++ b/packages/common/business_components/src/ui/form/test.tsx @@ -1,27 +1,27 @@ import { zodResolver } from "@hookform/resolvers/zod" import { useForm } from "react-hook-form" import { z } from "zod" -import UIForm from "." -import { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from "./form" +import { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from "./lib/form" import { Input } from "@common/components/ui" +import { UiForm } from "." export default function Test (){ - const formSchema2= z.object({ + const formSchema= z.object({ username: z.string().min(2).max(50), }) - const form = useForm>({ - resolver: zodResolver(formSchema2), + const form = useForm>({ + resolver: zodResolver(formSchema), defaultValues: { username: "", }, }) // 2. Define a submit handler. - function onSubmit(values: z.infer) { + function onSubmit(values: z.infer) { // Do something with the form values. // ✅ This will be type-safe and validated. console.log(values) @@ -50,7 +50,7 @@ export default function Test (){ return (
- +
) } \ No newline at end of file diff --git a/packages/common/business_components/src/ui/select/lib/selectBox.tsx b/packages/common/business_components/src/ui/select/lib/selectBox.tsx index b416f8dec..08e3abed3 100644 --- a/packages/common/business_components/src/ui/select/lib/selectBox.tsx +++ b/packages/common/business_components/src/ui/select/lib/selectBox.tsx @@ -2,7 +2,7 @@ import * as React from "react" import * as SelectPrimitive from "@radix-ui/react-select" import { Check, ChevronDown, ChevronUp } from "lucide-react" -import { cn } from "@/lib/utils" +import { cn } from "../../../lib/utils" const Select = SelectPrimitive.Root