Skip to content

Commit

Permalink
Merge pull request #52 from kakao-tech-campus-2nd-step3/Develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Dobbymin authored Oct 8, 2024
2 parents 2424a4b + fab5b1c commit 8591c1b
Show file tree
Hide file tree
Showing 20 changed files with 2,155 additions and 5,059 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"msw": "^2.3.5",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-hook-form": "^7.53.0",
"react-icons": "^5.2.1",
"react-modal": "^3.16.1",
"react-router-dom": "^6.26.1",
Expand Down
6,614 changes: 1,710 additions & 4,904 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

27 changes: 16 additions & 11 deletions src/app/routes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { RouterPath } from './path';
import MainPage from '@/pages/common/main';
import RegisterPage from '@/pages/common/register';
import SeniorRegisterPage from '@/pages/guard/register';
import SiniddoReviewPage from '@/pages/guard/review';
import ServiceHistoryPage from '@/pages/guard/service-history';
import CallBackDetailPage from '@/pages/siniddo/call-back/detail';
import CallBackListPage from '@/pages/siniddo/call-back/list';
Expand All @@ -15,64 +16,68 @@ import MyPage from '@/pages/siniddo/mypage';

const router = createBrowserRouter([
{
path: RouterPath.root,
path: RouterPath.ROOT,
element: <MainPage />,
},
{
path: RouterPath.register,
path: RouterPath.REGISTER,
element: <RegisterPage />,
},
{
path: RouterPath.mypage,
path: RouterPath.MYPAGE,
element: <MyPage />,
},
{
path: RouterPath.serviceHistory,
path: RouterPath.SERVICE_HISTORY,
element: <ServiceHistoryPage />,
},
{
path: RouterPath.helloCall,
path: RouterPath.HELLO_CALL,
children: [
{
index: true,
element: <HelloCallListPage />,
},
{
path: RouterPath.helloCallService,
path: RouterPath.HELLO_CALL_SERVICE,
element: <HelloCallServicePage />,
},
{
path: RouterPath.helloCallReport,
path: RouterPath.HELLO_CALL_REPORT,
element: <HelloCallReportPage />,
},
],
},
{
path: RouterPath.seniorRegister,
path: RouterPath.SENIOR_REGISTER,
element: <SeniorRegisterPage />,
},
{
path: RouterPath.callBackList,
path: RouterPath.CALL_BACK_LIST,
children: [
{
index: true,
element: <CallBackListPage />,
},
{
path: RouterPath.callBackDetail,
path: RouterPath.CALL_BACK_DETAIL,
children: [
{
index: true,
element: <CallBackDetailPage />,
},
{
path: RouterPath.callBackGuidLine,
path: RouterPath.CALL_BACK_GUID_LINE,
element: <SiniddoGuideLinePage />,
},
],
},
],
},
{
path: RouterPath.SINIDDO_REVIEW,
element: <SiniddoReviewPage />,
},
]);

export const Routes = () => {
Expand Down
25 changes: 13 additions & 12 deletions src/app/routes/path.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
export const RouterPath = {
root: '/',
login: '/login',
register: '/register',
mypage: `/mypage`,
serviceHistory: `/service-history`,
helloCallService: 'service',
helloCallReport: 'report',
helloCall: `/hello-call`,
callBackList: '/call-back',
callBackDetail: ':callBackId',
callBackGuidLine: ':guideLineId',
seniorRegister: `/senior-register`,
ROOT: '/',
LOGIN: '/login',
REGISTER: '/register',
MYPAGE: `/mypage`,
SERVICE_HISTORY: `/service-history`,
HELLO_CALL_SERVICE: 'service',
HELLO_CALL_REPORT: 'report',
HELLO_CALL: `/hello-call`,
CALL_BACK_LIST: '/call-back',
CALL_BACK_DETAIL: ':callBackId',
CALL_BACK_GUID_LINE: ':guideLineId',
SENIOR_REGISTER: `/senior-register`,
SINIDDO_REVIEW: `/siniddo-review`,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { UseFormRegister } from 'react-hook-form';

import type { FormValues } from '../../../types';
import { Input, FormControl, FormErrorMessage } from '@chakra-ui/react';
import styled from '@emotion/styled';

type Props = {
label: string;
placeholder: string;
error?: string;
registerProps: ReturnType<UseFormRegister<FormValues>>;
};

export const FormField = ({
label,
placeholder,
error,
registerProps,
}: Props) => (
<FormControl isInvalid={!!error}>
<Title>
<EmphasisSpan>{label}</EmphasisSpan>을 μž…λ ₯ν•΄μ£Όμ„Έμš”.
</Title>
<Input size='lg' placeholder={placeholder} {...registerProps} />
{error && <FormErrorMessage>{error}</FormErrorMessage>}
</FormControl>
);

const Title = styled.h1`
font-size: 24px;
font-weight: 700;
margin-top: 30px;
margin-bottom: 10px;
`;

const EmphasisSpan = styled.span`
color: #c69090;
`;
50 changes: 28 additions & 22 deletions src/pages/common/register/components/register-fields/index.tsx
Original file line number Diff line number Diff line change
@@ -1,33 +1,39 @@
import { Input } from '@chakra-ui/react';
import { FieldErrors, UseFormRegister } from 'react-hook-form';

import type { FormValues } from '../../types';
import { FormField } from './form-fileds';
import styled from '@emotion/styled';

export const RegisterFields = () => {
type Props = {
register: UseFormRegister<FormValues>;
errors: FieldErrors<FormValues>;
};

export const RegisterFields = ({ register, errors }: Props) => {
return (
<Wrapper>
<Title>
<EmphasisSpan>이름</EmphasisSpan>을 μž…λ ₯ν•΄μ£Όμ„Έμš”.
</Title>
<Input size='lg' placeholder='μ˜ˆμ‹œ: 홍길동' />

<Title>
<EmphasisSpan>μ—°λ½μ²˜</EmphasisSpan>λ₯Ό μž…λ ₯ν•΄μ£Όμ„Έμš”.
</Title>
<Input size='lg' placeholder='μ˜ˆμ‹œ: 010-0000-0000' />
<FormField
label='이름'
placeholder='μ˜ˆμ‹œ: 홍길동'
error={errors.name?.message}
registerProps={register('name', { required: '이름을 μž…λ ₯ν•΄μ£Όμ„Έμš”.' })}
/>
<FormField
label='μ—°λ½μ²˜'
placeholder='μ˜ˆμ‹œ: 010-0000-0000'
error={errors.phoneNumber?.message}
registerProps={register('phoneNumber', {
required: 'μ—°λ½μ²˜λ₯Ό μž…λ ₯ν•΄μ£Όμ„Έμš”.',
pattern: {
value: /^010-\d{4}-\d{4}$/,
message: 'μœ νš¨ν•œ μ—°λ½μ²˜ ν˜•μ‹μ΄ μ•„λ‹™λ‹ˆλ‹€.',
},
})}
/>
</Wrapper>
);
};

const Wrapper = styled.div`
width: 100%;
`;

const Title = styled.h1`
font-size: 24px;
font-weight: 700;
margin-top: 30px;
margin-bottom: 10px;
`;

const EmphasisSpan = styled.span`
color: #c69090;
`;
44 changes: 19 additions & 25 deletions src/pages/common/register/components/register-type/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
import { TypeButton } from './type-button.tsx';
import styled from '@emotion/styled';

export const RegisterType = () => {
type Props = {
userType: string;
handleClick: (id: string) => void;
};

export const RegisterType = ({ userType, handleClick }: Props) => {
return (
<Wrapper>
<Title>κ°€μž… μœ ν˜•</Title>
<TypeWrapper>
<DefaultBtn>μ‹œλ‹ˆλ˜</DefaultBtn>
<GrayBtn>보호자</GrayBtn>
<TypeButton
id='sinitto'
content='μ‹œλ‹ˆλ˜'
isSelected={userType == 'sinitto'}
handleClick={handleClick}
/>
<TypeButton
id='guard'
content='보호자'
isSelected={userType == 'guard'}
handleClick={handleClick}
/>
</TypeWrapper>
</Wrapper>
);
Expand All @@ -29,25 +45,3 @@ const TypeWrapper = styled.div`
justify-content: space-between;
margin-top: 13px;
`;

const DefaultBtn = styled.button`
width: 45%;
height: 70px;
border-radius: 10px;
background-color: #c69090;
color: #ffffff;
font-size: 22px;
font-weight: 700;
`;

const GrayBtn = styled.button`
width: 45%;
height: 70px;
border-radius: 10px;
background-color: #f2f2f2;
color: #909090;
font-size: 22px;
font-weight: 400;
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import styled from '@emotion/styled';

type Props = {
id: string;
isSelected: boolean;
content: string;
handleClick: (id: string) => void;
};

export const TypeButton = ({ content, isSelected, id, handleClick }: Props) => {
return (
<TypeBtn
type='button'
isSelected={isSelected}
onClick={() => handleClick(id)}
>
{content}
</TypeBtn>
);
};

type BtnProps = {
isSelected: boolean;
};

const TypeBtn = styled.button<BtnProps>`
width: 45%;
height: 70px;
border-radius: 10px;
background-color: ${(props) =>
props.isSelected ? 'var(--color-primary)' : '#f2f2f2'};
color: ${(props) => (props.isSelected ? 'var(--color-white)' : '#909090')};
font-size: 22px;
font-weight: ${(props) => (props.isSelected ? '600' : '400')};
outline: 0;
`;
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import { GUARD_DATA } from '../../../data/guard';
import type { TosData } from '../../../types';
import styled from '@emotion/styled';

// 보호자 μ„œμ•½μ„œ λ‚΄μš©
export const TosGuard = () => {
type Props = {
data: TosData;
};

export const TosContent = ({ data }: Props) => {
return (
<Wrapper>
<Intro>{GUARD_DATA.intro}</Intro>
{GUARD_DATA.sections.map((section, index) => (
<Intro>{data.intro}</Intro>
{data.sections.map((section, index) => (
<Paragraph key={index}>
<Title>{section.title}</Title>
{section.contents.map((content, i) => (
Expand Down
Loading

0 comments on commit 8591c1b

Please sign in to comment.