Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FE] 약속 생성 확인 모달 복구를 develop 브랜치에 적용 #415

Merged
merged 3 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { css } from '@emotion/react';

import theme from '@styles/theme';

export const s_descriptionContainer = css`
display: flex;
flex-direction: column;
gap: 0.8rem;

strong {
${theme.typography.captionBold}
color: ${theme.colors.primary}
}
`;

export const s_description = css`
${theme.typography.captionMedium}
display: flex;
gap: 0.8rem;
`;

export const s_availableDateDescription = css`
display: flex;
flex-direction: column;
gap: 1rem;
`;

export const s_availableDatesContainer = css`
${theme.typography.captionMedium}
display: grid;
grid-template-columns: 2fr 5fr;
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import ConfirmModal from '@components/_common/Modal/ConfirmModal';

import groupDates from '@utils/groupDates';

import {
s_availableDateDescription,
s_availableDatesContainer,
s_description,
s_descriptionContainer,
} from './MeetingCreationConfirmModal.styles';

interface MeetingCreationConfirmModalProps {
isModalOpen: boolean;
onModalClose: () => void;
onModalConfirmButtonClick: () => void;
meetingName: string;
hostName: string;
selectedDates: string[];
startTime: string;
endTime: string;
isOnlyDaysOptionChecked: boolean;
}

export default function MeetingCreationConfirmModal({
isModalOpen,
onModalClose,
onModalConfirmButtonClick,
meetingName,
hostName,
selectedDates,
startTime,
endTime,
isOnlyDaysOptionChecked,
}: MeetingCreationConfirmModalProps) {
return (
<ConfirmModal
isOpen={isModalOpen}
onClose={onModalClose}
onConfirm={onModalConfirmButtonClick}
position="center"
size="small"
title="입력하신 약속 정보를 확인해주세요."
>
<div css={s_descriptionContainer}>
<p css={s_description}>
<strong>약속명</strong> {meetingName}
</p>
<p css={s_description}>
<strong>주최자</strong> {hostName}
</p>
{!isOnlyDaysOptionChecked && (
<p css={s_description}>
<strong>약속 시간</strong> {startTime} ~ {endTime}
</p>
)}
<div css={s_availableDateDescription}>
<strong>가능 날짜</strong>
{groupDates(selectedDates).map(([monthYear, dates]) => {
const [year, month] = monthYear.split('-');
return (
<div css={s_availableDatesContainer} key={monthYear}>
<h3>
{year}년 {month}월
</h3>
<p>{dates.join(', ')}</p>
</div>
);
})}
</div>
</div>
</ConfirmModal>
);
}
71 changes: 45 additions & 26 deletions frontend/src/pages/CreateMeetingPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,21 @@ import MeetingDateTime from '@pages/CreateMeetingPage/components/MeetingDateTime
import MeetingHostInfo from '@pages/CreateMeetingPage/components/MeetingHostInfo';
import MeetingName from '@pages/CreateMeetingPage/components/MeetingName';

import useConfirmModal from '@hooks/useConfirmModal/useConfirmModal';
import useCreateMeeting from '@hooks/useCreateMeeting/useCreateMeeting';
import useFunnel from '@hooks/useFunnel/useFunnel';

import { CREATE_MEETING_STEPS, meetingStepValues } from '@constants/meeting';

import MeetingCreationConfirmModal from './components/MeetingCreationConfirmModal';

type Steps = typeof meetingStepValues;

export default function CreateMeetingPage() {
const { isConfirmModalOpen, onToggleConfirmModal } = useConfirmModal();

const [setStep, Funnel] = useFunnel<Steps>(meetingStepValues, '약속이름');

const {
meetingNameInput,
isMeetingNameInvalid,
Expand All @@ -25,31 +31,44 @@ export default function CreateMeetingPage() {
} = useCreateMeeting();

return (
<Funnel>
<Funnel.Step name={CREATE_MEETING_STEPS.meetingName}>
<MeetingName
meetingNameInput={meetingNameInput}
isMeetingNameInvalid={isMeetingNameInvalid}
onNextStep={() => setStep(CREATE_MEETING_STEPS.meetingHostInfo)}
/>
</Funnel.Step>
<Funnel.Step name={CREATE_MEETING_STEPS.meetingHostInfo}>
<MeetingHostInfo
hostNickNameInput={hostNickNameInput}
hostPasswordInput={hostPasswordInput}
isHostInfoInvalid={isHostInfoInvalid}
onNextStep={() => setStep(CREATE_MEETING_STEPS.meetingDateTime)}
/>
</Funnel.Step>
<Funnel.Step name={CREATE_MEETING_STEPS.meetingDateTime}>
<MeetingDateTime
meetingDateInput={meetingDateInput}
meetingTimeInput={meetingTimeInput}
meetingTypeInput={meetingTypeInput}
isCreateMeetingFormInvalid={isCreateMeetingFormInvalid}
onMeetingCreateButtonClick={handleMeetingCreateButtonClick}
/>
</Funnel.Step>
</Funnel>
<>
<Funnel>
<Funnel.Step name={CREATE_MEETING_STEPS.meetingName}>
<MeetingName
meetingNameInput={meetingNameInput}
isMeetingNameInvalid={isMeetingNameInvalid}
onNextStep={() => setStep(CREATE_MEETING_STEPS.meetingHostInfo)}
/>
</Funnel.Step>
<Funnel.Step name={CREATE_MEETING_STEPS.meetingHostInfo}>
<MeetingHostInfo
hostNickNameInput={hostNickNameInput}
hostPasswordInput={hostPasswordInput}
isHostInfoInvalid={isHostInfoInvalid}
onNextStep={() => setStep(CREATE_MEETING_STEPS.meetingDateTime)}
/>
</Funnel.Step>
<Funnel.Step name={CREATE_MEETING_STEPS.meetingDateTime}>
<MeetingDateTime
meetingDateInput={meetingDateInput}
meetingTimeInput={meetingTimeInput}
meetingTypeInput={meetingTypeInput}
isCreateMeetingFormInvalid={isCreateMeetingFormInvalid}
onMeetingCreateButtonClick={onToggleConfirmModal}
/>
</Funnel.Step>
</Funnel>
<MeetingCreationConfirmModal
isModalOpen={isConfirmModalOpen}
onModalClose={onToggleConfirmModal}
onModalConfirmButtonClick={handleMeetingCreateButtonClick}
meetingName={meetingNameInput.value}
hostName={hostNickNameInput.value}
selectedDates={Array.from(meetingDateInput.selectedDates)}
startTime={meetingTimeInput.startTime.value}
endTime={meetingTimeInput.endTime.value}
isOnlyDaysOptionChecked={meetingTypeInput.isChecked}
/>
</>
);
}