Skip to content

Commit 334e603

Browse files
committed
feat: add API
1. 테스트 #25
1 parent 8683cf4 commit 334e603

File tree

36 files changed

+631
-233
lines changed

36 files changed

+631
-233
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
"react-dom": "^17.0.2",
2020
"react-router-dom": "^5.3.0",
2121
"styled-components": "^5.3.3",
22-
"styled-reset": "^4.3.4"
22+
"styled-reset": "^4.3.4",
23+
"swr": "^1.1.2",
24+
"universal-cookie": "^4.0.4"
2325
},
2426
"devDependencies": {
2527
"@babel/core": "^7.16.0",

src/components/atomic/atoms/Image/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export interface IImageProps {
66
objectFit?: string;
77
src: string;
88
alt?: string;
9-
maxWidth: string;
9+
maxWidth?: string;
1010
width: string;
1111
height: string;
1212
borderRadius?: string;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import React from 'react';
2+
3+
import Button from '@/components/atomic/atoms/Button';
4+
import Text from '@/components/atomic/atoms/Text';
5+
6+
interface IKakaoLoginButtonProps {
7+
onClick: () => void;
8+
}
9+
10+
const KakaoLoginButton = ({ onClick }: IKakaoLoginButtonProps) => {
11+
return (
12+
<Button
13+
maxWidth="375px"
14+
width="100%"
15+
height="54px"
16+
backgroundColor="#FEE500"
17+
boxShadow="0px 0px 4px rgba(0, 0, 0, 0.25)"
18+
onClick={onClick}>
19+
<Text fontColor="black" fontSize="16px" fontWeight="500">
20+
카카오 로그인
21+
</Text>
22+
</Button>
23+
);
24+
};
25+
26+
export default KakaoLoginButton;

src/components/atomic/atoms/LeftRadiusButton/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import Text from '@/components/atomic/atoms/Text';
66
interface ILeftRadiusButtonProps {
77
width: string;
88
backgroundColor: string;
9+
fontColor?: string;
10+
boxShadow?: string;
911
margin?: string;
1012
disabled?: boolean;
1113
onClick?: (e: MouseEvent<HTMLButtonElement>) => void;
@@ -18,6 +20,8 @@ interface ILeftRadiusButtonComponentProps extends ILeftRadiusButtonProps {
1820
const LeftRadiusButton = ({
1921
width,
2022
backgroundColor,
23+
fontColor = '#FFFFFF',
24+
boxShadow = '0',
2125
margin,
2226
disabled = false,
2327
onClick,
@@ -30,10 +34,11 @@ const LeftRadiusButton = ({
3034
height="54px"
3135
backgroundColor={backgroundColor}
3236
borderRadius="20px 0px 0px 0px"
37+
boxShadow={boxShadow}
3338
margin={margin}
3439
disabled={disabled}
3540
onClick={onClick}>
36-
<Text fontColor="#FFFFFF" fontSize="18px" fontWeight="700">
41+
<Text fontColor={fontColor} fontSize="18px" fontWeight="700">
3742
{children}
3843
</Text>
3944
</Button>

src/components/atomic/molecules/EmptyImageLabel/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ interface IEmptyImageLabel {
99
width: number;
1010
height: number;
1111
margin?: string;
12+
onChangeImg: (e: React.ChangeEvent<HTMLInputElement>) => void;
1213
}
1314

14-
const EmptyImageLabel = ({ width, height, margin = '0' }: IEmptyImageLabel) => {
15+
const EmptyImageLabel = ({ width, height, margin = '0', onChangeImg }: IEmptyImageLabel) => {
1516
return (
1617
<>
1718
<Label
@@ -24,7 +25,7 @@ const EmptyImageLabel = ({ width, height, margin = '0' }: IEmptyImageLabel) => {
2425
htmlFor="file">
2526
<Icon icon="EmptyImage" width={30} height={30} />
2627
</Label>
27-
<StyledInput id="file" type="file" accept="image/png, image/jpeg" />
28+
<StyledInput id="file" type="file" onChange={onChangeImg} accept="image/png, image/jpeg" />
2829
</>
2930
);
3031
};

src/components/atomic/molecules/GroupInfoPeople/index.tsx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import React, { useState, useCallback, useRef, useEffect } from 'react';
22

3+
import client from '@/lib/api/client';
4+
35
import Input from '@/components/atomic/atoms/Input';
46
import Button from '@/components/atomic/atoms/Button';
57
import Text from '@/components/atomic/atoms/Text';
@@ -12,9 +14,9 @@ import { Contents, InputWrapper } from './style';
1214

1315
interface IGroupInfoPeople {
1416
email: string;
15-
members: Array<string>;
17+
members: Array<number>;
1618
onChangeEmail: (e: React.ChangeEvent<HTMLInputElement>) => void;
17-
setMembers: React.Dispatch<React.SetStateAction<IGroupStateProps>>;
19+
setMembers: React.Dispatch<React.SetStateAction<Array<number>>>;
1820
}
1921

2022
const GroupInfoPeople = ({ email, members, onChangeEmail, setMembers }: IGroupInfoPeople) => {
@@ -25,6 +27,15 @@ const GroupInfoPeople = ({ email, members, onChangeEmail, setMembers }: IGroupIn
2527
setOpen((prev) => !prev);
2628
}, [open]);
2729

30+
const onClickAdd = async () => {
31+
const res = await client.post('/member', { email });
32+
if (res.status === 200) {
33+
const memberId = res.data.id;
34+
setMembers([...members, memberId]);
35+
alert('추가 되었습니다!');
36+
}
37+
};
38+
2839
useEffect(() => {
2940
if (open) {
3041
inputRef.current?.focus();
@@ -49,7 +60,7 @@ const GroupInfoPeople = ({ email, members, onChangeEmail, setMembers }: IGroupIn
4960
height="50px"
5061
borderBottom="1px solid black"
5162
/>
52-
<Button width="50px" height="30px" borderRadius="15px" backgroundColor="#6BE065">
63+
<Button onClick={onClickAdd} width="50px" height="30px" borderRadius="15px" backgroundColor="#6BE065">
5364
<Text fontColor="#FFFFFF" fontSize="14px" fontWeight="500">
5465
추가
5566
</Text>

src/components/atomic/molecules/GroupResultInfo/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ const GroupResultInfo = ({ party }: IGroupResultInfoProps) => {
2424
<Image objectFit="cover" src={party.imageUrl} maxWidth="500px" width="100%" height="200px" />
2525
<ContentsWrapper>
2626
<TravelHistorySummary
27-
name={party.title}
28-
startDate={party.period[0]}
29-
endDate={party.period[1]}
27+
title={party.title}
28+
period={party.period}
3029
location={party.location}
3130
participantsCount={party.participantsCount}
3231
type="white"

src/components/atomic/molecules/TravelHistoryImage/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import { ITravelHistoryImage } from '@/types/travelHistory';
77

88
import { Wrapper, PositionWrapper } from './style';
99

10-
const TravelHistoryImage = ({ src, alt }: ITravelHistoryImage) => {
10+
const TravelHistoryImage = ({ imageUrl, alt, isAgreed }: ITravelHistoryImage) => {
1111
return (
1212
<Wrapper>
1313
<Image
14-
src={src || '/image/Christmas.png'}
14+
src={imageUrl || '/image/Christmas.png'}
1515
alt={alt || '크리스마스 사진'}
1616
width="100%"
1717
maxWidth="150px"

src/components/atomic/molecules/TravelHistorySummary/index.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,17 @@ const typeCheck = (type: string) => {
1515
};
1616

1717
const TravelHistorySummary = ({
18-
name,
19-
startDate,
20-
endDate,
18+
title,
19+
period,
2120
location,
2221
participantsCount,
2322
type = 'black',
2423
}: ITravelHistorySummary) => {
2524
const isBlackType = typeCheck(type);
25+
const sDate = new Date(period[0]);
26+
const eDate = new Date(period[1]);
27+
let startDate = sDate.getFullYear() + '-' + (sDate.getMonth() + 1) + '-' + sDate.getDay();
28+
let endDate = eDate.getFullYear() + '-' + (eDate.getMonth() + 1) + '-' + eDate.getDay();
2629

2730
return (
2831
<Wrapper>
@@ -31,15 +34,15 @@ const TravelHistorySummary = ({
3134
fontColor={isBlackType ? Theme.F_4 : Theme.F_1}
3235
fontSize={isBlackType ? '15px' : '20px'}
3336
fontWeight={isBlackType ? '500' : '700'}>
34-
{name}
37+
{title}
3538
</Text>
3639
) : (
3740
<FlexWrapper isBlackType={isBlackType}>
3841
<Text
3942
fontColor={isBlackType ? Theme.F_4 : Theme.F_1}
4043
fontSize={isBlackType ? '15px' : '20px'}
4144
fontWeight={isBlackType ? '500' : '700'}>
42-
{name}
45+
{title}
4346
</Text>
4447
</FlexWrapper>
4548
)}

src/components/atomic/molecules/TreatySelectionBox/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ export interface ITreatySelectionBoxProps {
1111
title: string;
1212
isAgreed: boolean;
1313
color: string;
14-
count0: number;
15-
count1: number;
14+
count0: string;
15+
count1: string;
1616
selected: number;
1717
}
1818

@@ -25,7 +25,7 @@ const TreatySelectionBox = ({ title, isAgreed, color, count0, count1, selected }
2525
</Text>
2626
{isAgreed === false && <TreatyWarningText />}
2727
</TitleWrapper>
28-
<TreatyVersusSelection color={color} isAgreed={isAgreed} selected={selected} />
28+
<TreatyVersusSelection color={color} isAgreed={isAgreed} selected={selected} count0={count0} count1={count1} />
2929
</Wrapper>
3030
);
3131
};

0 commit comments

Comments
 (0)