From 032d24fe896939c5cb45d0f79100b9a189b89cf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=98=81=EC=9A=B0?= Date: Sun, 12 Nov 2023 20:47:46 +0900 Subject: [PATCH] =?UTF-8?q?[feat]=20contact=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EC=97=B0=EB=8F=99=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/room.ts | 12 +++- components/Modal/ModalBox.tsx | 22 +++--- components/Modal/ModalContainer.tsx | 1 + components/Textarea/Textarea.module.scss | 7 +- components/Textarea/Textarea.tsx | 4 +- pages/room/[id].tsx | 85 ++++++++++++++++++++++-- public/icons/close.svg | 7 +- public/types/room.ts | 6 ++ 8 files changed, 118 insertions(+), 26 deletions(-) diff --git a/api/room.ts b/api/room.ts index 18450e2..01c872b 100644 --- a/api/room.ts +++ b/api/room.ts @@ -1,4 +1,4 @@ -import { Furnishing, Room, RoomFile, RoomSearch, RoomSearchParams } from '@/public/types/room'; +import { ContactParams, Furnishing, Room, RoomFile, RoomSearch, RoomSearchParams } from '@/public/types/room'; import { fetchData } from './index'; export const fetchFurnishings = async () => { @@ -51,3 +51,13 @@ export const deleteRoom = async (id: string) => { }, }); }; + +export const contactRoom = async (params: ContactParams) => { + return fetchData(`/api/v1/rooms/${params.roomId}/contact`, { + method: 'POST', + body: JSON.stringify(params), + headers: { + 'Content-Type': 'application/json', + }, + }); +}; diff --git a/components/Modal/ModalBox.tsx b/components/Modal/ModalBox.tsx index e053cac..69faf53 100644 --- a/components/Modal/ModalBox.tsx +++ b/components/Modal/ModalBox.tsx @@ -25,6 +25,7 @@ function Modal({ buttonName = '', buttonName2 = '', buttonNames = [], + hasButton = true, size = 'md', }: ModalProps) { const { closeModal } = useModal(); @@ -116,7 +117,7 @@ function Modal({ {hasCloseButton && (
)} @@ -131,14 +132,19 @@ function Modal({ /> )} - {buttonType && buttonType !== 'none' && buttonType !== 'wrapper' ? ( -
{renderButton()}
- ) : ( + {hasButton && ( + // eslint-disable-next-line react/jsx-no-useless-fragment <> -
{renderButton()}
- + {buttonType && buttonType !== 'none' && buttonType !== 'wrapper' ? ( +
{renderButton()}
+ ) : ( +
+ {renderButton()} + +
+ )} )} diff --git a/components/Modal/ModalContainer.tsx b/components/Modal/ModalContainer.tsx index 51a31bf..b68215e 100644 --- a/components/Modal/ModalContainer.tsx +++ b/components/Modal/ModalContainer.tsx @@ -23,6 +23,7 @@ export interface ModalProps { buttonName2?: string; buttonNames?: Array; buttonNumber?: number; + hasButton?: boolean; size?: 'md' | 'full'; } diff --git a/components/Textarea/Textarea.module.scss b/components/Textarea/Textarea.module.scss index 68cf47c..05ca27d 100644 --- a/components/Textarea/Textarea.module.scss +++ b/components/Textarea/Textarea.module.scss @@ -1,8 +1,7 @@ .textArea { - @apply w-full px-3 py-2 border border-gray-300 rounded-md resize-none focus:outline-none focus:ring focus:border-[#FF8E00]; + @apply w-full px-3 py-2 border border-gray-300 rounded-md resize-none focus:outline-none focus:ring focus:border-[#FF8E00] font-normal; &.placeholder { - @apply text-g4; + @apply text-g4 font-normal; } - -} \ No newline at end of file +} diff --git a/components/Textarea/Textarea.tsx b/components/Textarea/Textarea.tsx index a052793..63cfbde 100644 --- a/components/Textarea/Textarea.tsx +++ b/components/Textarea/Textarea.tsx @@ -51,7 +51,7 @@ function Textarea({ placeholder, register, maxByte, maxLength, initValue, classN return (