diff --git a/src/components/layout/CommonHeader.tsx b/src/components/layout/CommonHeader.tsx index f31202c..02c5bf0 100644 --- a/src/components/layout/CommonHeader.tsx +++ b/src/components/layout/CommonHeader.tsx @@ -1,69 +1,95 @@ -import CheckIcon from "@material-ui/icons/Check"; -import ArrowBackIosNewIcon from '@mui/icons-material/ArrowBackIosNew'; -import { - Box, - AppBar, - Toolbar, - IconButton, - Typography, -} from '@mui/material'; -import { ReactElement } from 'react'; +import { AppBar, Box, IconButton, Typography } from '@mui/material'; +import { ReactElement, ReactNode } from 'react'; import { useNavigate } from 'react-router-dom'; -import Spacer from '../common/Spacer'; export interface CommonHeaderProps { title: string; - isShowBackButton?: boolean; - rightButtonIcon?: ReactElement; - isShowRightButton?: boolean; - // onClickRightButton?: (event: React.MouseEvent) => {}; - onClickRightButton?: (event: React.MouseEvent) => void; + isShowPrevButton?: boolean; + prevButtonIcon?: ReactNode; + prevButtonText?: string; + onClickPrevButton?: (event: React.MouseEvent) => void; + isShowNextButton?: boolean; + nextButtonIcon?: ReactElement; + nextButtonText?: string; + onClickNextButton?: (event: React.MouseEvent) => void; } const CommonHeader = (props: CommonHeaderProps) => { const navigation = useNavigate(); - return ( - // - - - - {props.isShowBackButton ? ( - navigation(-1)} - > - - - ) : ( - - )} - + + {props.isShowPrevButton && ( + { + if (props.onClickPrevButton) { + props.onClickPrevButton(event); + } else { + navigation(-1); + } + } + } + > + + {props.prevButtonText ?? '뒤로'} + + + )} + + + + {props.title} + + + + {props.isShowNextButton && ( + - {props.title} - - {props.isShowRightButton && ( - - {props.rightButtonIcon} - - - )} - - - + + {props.nextButtonText ?? '완료'} + + + )} + + ); }; -export default CommonHeader; \ No newline at end of file +export default CommonHeader; diff --git a/src/hooks/signUpSteps.ts b/src/hooks/signUpSteps.ts index 41f87d9..6a78233 100755 --- a/src/hooks/signUpSteps.ts +++ b/src/hooks/signUpSteps.ts @@ -21,6 +21,7 @@ export function useSignUpStepForm(steps: ReactElement[]) { */ function handlePrevButton() { const currIdx = currentStepIndex; + console.log(currIdx) if (currIdx <= 0) { navigate('/login', { replace: true }); } else { diff --git a/src/pages/auth/common/Wrapper.tsx b/src/pages/auth/common/Wrapper.tsx index 305a9a3..617d3a9 100644 --- a/src/pages/auth/common/Wrapper.tsx +++ b/src/pages/auth/common/Wrapper.tsx @@ -26,11 +26,13 @@ const Wrapper = ({ > - + {/* */} {headerComp} {children} diff --git a/src/pages/auth/resetPW/ResetPW.tsx b/src/pages/auth/resetPW/ResetPW.tsx index 2248842..8d3eac0 100644 --- a/src/pages/auth/resetPW/ResetPW.tsx +++ b/src/pages/auth/resetPW/ResetPW.tsx @@ -9,7 +9,6 @@ import InputForm, { InputItemType } from '../common/InputForm'; const SetPW = (props: any) => { const [signUpData, setSignUpData] = useRecoilState(signUpDataState); const [nextButtonProps, setNextButtonProps] = useRecoilState(stepButtonProps); - // const setInstruction = useSetRecoilState(stepInstruction); const [pWChgMode, setPWChgMode] = useRecoilState(resetPWMode); diff --git a/src/pages/auth/resetPW/ResetPWMode.tsx b/src/pages/auth/resetPW/ResetPWMode.tsx index bbae0ed..0500096 100644 --- a/src/pages/auth/resetPW/ResetPWMode.tsx +++ b/src/pages/auth/resetPW/ResetPWMode.tsx @@ -51,12 +51,6 @@ const ResetPWMode = (props: any) => { }); }, []); - - useEffect(() => { - - - }, [pWChgMode]); - return ( { - const setStepType = useSetRecoilState(currentFormType); const [currentStepIndex, setCurrentStepIndex] = useRecoilState(stepIndex); const [pWChgMode, setPWChgMode] = useRecoilState(resetPWMode); @@ -49,20 +43,12 @@ const ResetPWStep = () => { return ( - {'비밀번호 변경'} - + } > { const currentStepIndex = useRecoilValue(stepIndex); @@ -68,26 +65,30 @@ const SignUp = () => { return ( - - - 약관동의 - - + + + + 약관동의 + - + } > { }, []); return ( - <> - + + } + > {categories?.map((category, idx) => { @@ -139,7 +143,7 @@ const CategoryPage = () => { })} - + ); }; diff --git a/src/pages/category/CreateCategoryPage.tsx b/src/pages/category/CreateCategoryPage.tsx index 512dcd1..2c0c6fa 100644 --- a/src/pages/category/CreateCategoryPage.tsx +++ b/src/pages/category/CreateCategoryPage.tsx @@ -1,7 +1,6 @@ -import AddIcon from '@mui/icons-material/Add'; -import { Button, Divider, Grid, TextField, Typography } from '@mui/material'; +import { Button, TextField, Typography } from '@mui/material'; import { Box } from '@mui/system'; -import { useEffect, useState } from 'react'; +import { useState } from 'react'; import { ColorResult, SwatchesPicker } from 'react-color'; import { useLocation, useNavigate } from 'react-router-dom'; import { useRecoilValue } from 'recoil'; @@ -15,7 +14,7 @@ import Circle from '../../components/common/Circle'; import Spacer from '../../components/common/Spacer'; import CommonHeader from '../../components/layout/CommonHeader'; import { selectedSubCategoryState } from '../../store/category'; -import { categories } from '../../store/tempData'; +import Wrapper from '../auth/common/Wrapper'; const CreateCategoryPage = () => { const selectedSubCategory = useRecoilValue(selectedSubCategoryState); @@ -74,13 +73,16 @@ const CreateCategoryPage = () => { }; return ( - <> - handleSave()} - /> + handleSave()} + /> + } + > { 삭제하기 - + ); }; diff --git a/src/pages/record/EditRecordPage.tsx b/src/pages/record/EditRecordPage.tsx index 2ff8156..f57fecc 100644 --- a/src/pages/record/EditRecordPage.tsx +++ b/src/pages/record/EditRecordPage.tsx @@ -42,6 +42,7 @@ import { LocalizationProvider } from 'mui_pickers_6/LocalizationProvider'; import { Swiper, SwiperSlide } from 'swiper/react'; import 'swiper/css/effect-coverflow'; import FlexBox from '@/components/common/FlexBox'; +import Wrapper from '../auth/common/Wrapper'; export interface MainCategoryProps { categoryId: number; @@ -568,192 +569,194 @@ const EditRecordPage = (): ReactElement => { }, [selectedSubCategoryIdx, setRecoilSubCategoryValue, recoilCategoryValue]); return ( - - + - - - + } + > + + + - {/* Selected Days */} - + {/* Selected Days */} - + + + {['일', '월', '화', '수', '목', '금', '토'].map( + (day, dayIndex) => { + const isSelected = selectedDays.includes(dayIndex); + const isCurrentDate = currentDay === dayIndex; + return ( + handleDayChipClick(dayIndex)} + color={ + dayIndex === 0 + ? '#FF4444' + : dayIndex === 6 + ? '#3B66FF' + : '' + } + /> + ); + }, + )} + + + + {/* Time Range */} + - {['일', '월', '화', '수', '목', '금', '토'].map((day, dayIndex) => { - const isSelected = selectedDays.includes(dayIndex); - const isCurrentDate = currentDay === dayIndex; - return ( - handleDayChipClick(dayIndex)} - color={ - dayIndex === 0 ? '#FF4444' : dayIndex === 6 ? '#3B66FF' : '' - } - /> - ); - })} - - - - {/* Time Range */} - - {formatRangeTimeElem('start')} - - - ~ - - - {formatRangeTimeElem('end')} - - - + {formatRangeTimeElem('start')} + + + ~ + + + {formatRangeTimeElem('end')} + + + + + + + - - - - - {/* Main Categories */} - - {categories.length && - categories.map((category: MainCategoryProps, idx) => { - const isSelected = idx === selectedCategoryIdx; - return ( - { - setSelectedSubCategoryIdx(() => 0); - setSelectedCategoryIdx(idx); - }} - props={{ - isSelected, - backgroundColor: category.highlightColor, - }} - /> - ); - })} - - - + {categories.length && + categories.map((category: MainCategoryProps, idx) => { + const isSelected = idx === selectedCategoryIdx; + return ( + { + setSelectedSubCategoryIdx(() => 0); + setSelectedCategoryIdx(idx); + }} + props={{ + isSelected, + backgroundColor: category.highlightColor, + }} + /> + ); + })} + - {/* Sub Categories */} - - {categories[selectedCategoryIdx]?.subCategories.map( - (sub: SubCategoryProps) => { - const subSelected = selectedSubCategoryIdx === sub.categoryId; - return ( - - setSelectedSubCategoryIdx(() => sub.categoryId) - } - /> - ); - }, - )} - + - - - - setContent(e.target.value)} - /> - - - {recordType === 'UPDATE' && ( - - {BottomButton()} + {/* Sub Categories */} + + {categories[selectedCategoryIdx]?.subCategories.map( + (sub: SubCategoryProps) => { + const subSelected = selectedSubCategoryIdx === sub.categoryId; + return ( + + setSelectedSubCategoryIdx(() => sub.categoryId) + } + /> + ); + }, + )} + + + + + + setContent(e.target.value)} + /> + - )} - + {recordType === 'UPDATE' && ( + + {BottomButton()} + + )} + + ); }; diff --git a/src/pages/record/RecordPage.tsx b/src/pages/record/RecordPage.tsx index 0baeeb5..e068abb 100644 --- a/src/pages/record/RecordPage.tsx +++ b/src/pages/record/RecordPage.tsx @@ -33,6 +33,7 @@ import utc from 'dayjs/plugin/utc'; import '../../styles/custom-calendar-styles.css'; import '../../styles/custom-record-styles.css'; import { customCalendarType, currentCalendarType } from '@/store/common'; +import Wrapper from '../auth/common/Wrapper'; dayjs.extend(utc); dayjs.extend(timezone); @@ -60,9 +61,7 @@ const RecordPage = () => { const setSelectedEvent = useSetRecoilState(currentSelectedEvent); - const selectedDate = useRecoilValue( - currentSelectedDateForRecord, - ); + const selectedDate = useRecoilValue(currentSelectedDateForRecord); const periodType = useRecoilValue( currentPeriodForRecord, ); @@ -85,7 +84,6 @@ const RecordPage = () => { const interval = '00:30:00'; - /** * route to record create page of dragged time * @param event drag event @@ -207,8 +205,7 @@ const RecordPage = () => { }, []); return ( - <> - + }> { /> - + ); }; diff --git a/src/pages/settings/AccountSetting.tsx b/src/pages/settings/AccountSetting.tsx index 07e24c4..3ae2e69 100644 --- a/src/pages/settings/AccountSetting.tsx +++ b/src/pages/settings/AccountSetting.tsx @@ -4,21 +4,32 @@ import { IconButton, Input, InputAdornment, - Typography + Typography, } from '@mui/material'; import UserAvatar from '@/components/settings/UserAvatar'; import { useNavigate } from 'react-router-dom'; -import SettingWrapper from '../auth/common/Wrapper'; +import Wrapper from '../auth/common/Wrapper'; +import CommonHeader from '@/components/layout/CommonHeader'; const AccountSetting = () => { const navigation = useNavigate(); return ( - navigation('/settings')}> + + } + handlePrevBtn={() => navigation('/settings')} + > - + { multiline endAdornment={ - + { {'dodonenow.com'} - + ); }; diff --git a/src/pages/statistics/StatisticsPage.tsx b/src/pages/statistics/StatisticsPage.tsx index 78d3a3c..f272ff2 100644 --- a/src/pages/statistics/StatisticsPage.tsx +++ b/src/pages/statistics/StatisticsPage.tsx @@ -13,7 +13,7 @@ const StatisticsPage = () => { return ( <> - + {/* */} diff --git a/src/store/common.ts b/src/store/common.ts index 3636697..3c24558 100644 --- a/src/store/common.ts +++ b/src/store/common.ts @@ -34,7 +34,7 @@ export interface INextButtonState { text: string; } -export type FormType = 'SIGNUP' | 'LOGIN' | 'RECORD'; +export type FormType = 'SIGNUP' | 'LOGIN' | 'RECORD' | 'RESETPW'; export const currentFormType = atom({ key: 'CurrentFormType',