-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP) Reflect changes related to adding place logic
- Loading branch information
1 parent
dcbddc6
commit d29cb07
Showing
26 changed files
with
1,003 additions
and
387 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import * as React from "react"; | ||
import Image from "next/image"; | ||
import { cn } from "@/lib/utils"; | ||
|
||
export interface LabelWithValueProps | ||
extends React.InputHTMLAttributes<HTMLInputElement> { | ||
iconSrc?: string; | ||
required?: boolean; | ||
} | ||
|
||
const LabelWithValue = React.forwardRef<HTMLInputElement, LabelWithValueProps>( | ||
({ className, iconSrc, value, required, type = "text", ...props }, ref) => { | ||
return ( | ||
<div className="flex items-center w-full h-[24px]"> | ||
{iconSrc && ( | ||
<Image | ||
className="mr-[12px]" | ||
src={iconSrc} | ||
alt="icon" | ||
width={18} | ||
height={18} | ||
/> | ||
)} | ||
<input | ||
type={type} | ||
className={cn( | ||
"flex-1 bg-transparent text-[#8B95A1] text-[16px] outline-none", | ||
className | ||
)} | ||
value={value} | ||
ref={ref} | ||
{...props} | ||
/> | ||
</div> | ||
); | ||
} | ||
); | ||
LabelWithValue.displayName = "LabelWithValue"; | ||
export { LabelWithValue }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { z } from "zod"; | ||
import { UseFormProps, useForm } from "react-hook-form"; | ||
import { zodResolver } from "@hookform/resolvers/zod"; | ||
|
||
export type CommonPlaceDetailFormType = { | ||
// ํด๋น ํ์ผ์์๋ ์ฌ์ฉ์๊ฐ ํธ๋ค๋ง ๊ฐ๋ฅํ ๊ฐ๋ง ์ ์ | ||
scheduleId: number; | ||
name: string; | ||
type: string; | ||
url?: string; | ||
reviewCount?: number; | ||
starGrade?: number; | ||
openingHours?: string; | ||
phoneNumber?: string; | ||
address?: string; | ||
memo?: string; | ||
pictures: string[]; | ||
}; | ||
|
||
const addPlaceDetailSchema = z.object({ | ||
scheduleId: z.number(), | ||
name: z.string(), | ||
type: z.string(), | ||
url: z.string().optional(), | ||
reviewCount: z.number().optional(), | ||
starGrade: z.number().optional(), | ||
openingHours: z.string().optional(), | ||
phoneNumber: z.string().optional(), | ||
address: z.string().optional(), | ||
memo: z.string().optional(), | ||
pictures: z.array(z.string()), | ||
}); | ||
|
||
export const useAddPlaceDetailForm = ( | ||
options?: UseFormProps<CommonPlaceDetailFormType> | ||
) => { | ||
return useForm<CommonPlaceDetailFormType>({ | ||
resolver: zodResolver(addPlaceDetailSchema), | ||
mode: "onChange", | ||
reValidateMode: "onChange", | ||
...options, | ||
}); | ||
}; |
Oops, something went wrong.