Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
zestlee1106 committed Aug 30, 2023
2 parents bbc77c5 + 02d53ef commit 5c9151b
Show file tree
Hide file tree
Showing 11 changed files with 711 additions and 28 deletions.
12 changes: 10 additions & 2 deletions components/Modal/ModalBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import useModal from '../../hooks/useModal.ts';
import useOutSideClick from '../../hooks/useOutSideClick.ts';
import Button from '../Button/Button.tsx';
import Header from '../Header/Header.tsx';
import DefaultLayout from '../layouts/DefaultLayout.tsx';

function Modal({
children,
Expand All @@ -15,6 +14,7 @@ function Modal({
title = '',
content = '',
custom = false,
customHeader = false,
buttonType = 'none',
handleClose,
buttonName = '',
Expand Down Expand Up @@ -78,6 +78,14 @@ function Modal({
const goBack = () => {
closeModal();
};
const defaultHeader = () => {
let result = <Header type="title" title={title} right="close" logoColor="black" handleButtonClick={goBack} />;
// TODO 나중에 여기 layoutHeader쪽 Component를 받는 거로 변경
if (customHeader) {
result = <Header type="back" logoColor="black" bgColor="white" title="Add rooms" handleButtonClick={goBack} />;
}
return result;
};

return size === 'md' ? (
<div className={styles.overlay}>
Expand All @@ -102,7 +110,7 @@ function Modal({
</div>
) : (
<div className={styles.full}>
<Header type="title" title={title} right="close" logoColor="black" handleButtonClick={goBack} />
{defaultHeader()}
<div className="mt-[62px] px-[20px] text-g6 text-[16px] font-light">{custom ? children : content}</div>
</div>
);
Expand Down
1 change: 1 addition & 0 deletions components/Modal/ModalContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface ModalProps {
title?: string;
content?: string;
custom?: boolean;
customHeader?: boolean;
buttonType?: 'none' | 'both' | 'outline' | 'default';
handleClose?: () => void;
buttonName?: string;
Expand Down
2 changes: 1 addition & 1 deletion components/Typography/Typography.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
}

.body {
@apply font-pretendard;
@apply font-pretendard ;
}

.label {
Expand Down
27 changes: 25 additions & 2 deletions components/layouts/RoomListLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,36 @@
import React, { ReactNode } from 'react';
import React, { useState, useEffect, useCallback, ReactNode } from 'react';
import Header from '@/components/Header/Header.tsx';
import useModal from '@/hooks/useModal.ts';
import { useTranslation } from 'next-i18next';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
import { GetStaticPropsContext } from 'next';
import { Toast, Chip, Select, Typography, Toggle, Checkbox, Button, Input } from '@/components/index.tsx';
import { FieldValues, SubmitHandler, useForm } from 'react-hook-form';
import { GuList, DongList } from '../../public/js/guDongList.ts';
import Step1 from '@/pages/room/addRoom/step1.tsx';

interface AppLayoutProps {
children: ReactNode;
}

export const getStaticProps = async ({ locale }: GetStaticPropsContext) => ({
props: {
...(await serverSideTranslations(locale as string, ['filter', 'common'])),
},
});

function RoomListLayout({ children }: AppLayoutProps) {
const { openModal } = useModal();
const handleButtonClick = () => {
alert('add!!');
openModal({
props: {
title: 'Add Rooms',
size: 'full',
custom: true,
customHeader: true,
},
children: <Step1 />,
});
};

return (
Expand Down
5 changes: 2 additions & 3 deletions pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { useContext, useEffect, useState } from 'react';
import React, { useEffect, useState } from 'react';
import type { GetStaticPropsContext } from 'next';
import { useTranslation } from 'next-i18next';
import 'tailwindcss/tailwind.css';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
import RoomCard from '@/components/RoomCard/RoomCard';
Expand Down Expand Up @@ -109,7 +108,6 @@ function Home() {
};

const getChildData = async (childData: any) => {
console.log('childData', childData);
const filteredChips = makeSubmitParam(childData) as FilterType;
makeFilters(filteredChips);
await selectRooms();
Expand All @@ -121,6 +119,7 @@ function Home() {
title: 'Filters',
size: 'full',
custom: true,
customHeader: false,
},
children: <Filter closeModal={closeModal} getChildData={getChildData} roomsLength={(rooms || []).length} />,
});
Expand Down
Loading

0 comments on commit 5c9151b

Please sign in to comment.