Skip to content

Commit 61039e2

Browse files
1g2g1eecanimb96dlwl98
authored
refactor: 코딩 컨벤션 통일 (#89)
Co-authored-by: Chan Lee <[email protected]> Co-authored-by: Minjae Kim <[email protected]> Co-authored-by: 이진욱 <[email protected]>
1 parent fb64808 commit 61039e2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+294
-278
lines changed

Diff for: index.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
<html lang="ko">
33
<head>
44
<meta charset="UTF-8" />
5+
<meta
6+
name="viewport"
7+
content="width=device-width, initial-scale=1.0, maximum-scale=1"
8+
/>
59
<link rel="icon" type="image/svg+xml" href="/logo.svg" />
610
<link
711
href="https://cdn.jsdelivr.net/npm/[email protected]/reset.min.css"
@@ -11,7 +15,6 @@
1115
href="https://webfontworld.github.io/gmarket/GmarketSans.css"
1216
rel="stylesheet"
1317
/>
14-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
1518
<title>픽플</title>
1619
</head>
1720
<body>

Diff for: src/api/axiosInstance.ts

+1-7
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,8 @@ import axios from 'axios';
22

33
import { setAuthorization } from './interceptors';
44

5-
const PROD = import.meta.env.MODE === 'production';
6-
7-
const baseURL = PROD
8-
? `${location.protocol}//${location.host}`
9-
: import.meta.env.VITE_BASE_URL;
10-
115
export const axiosInstance = axios.create({
12-
baseURL,
6+
baseURL: '/api',
137
headers: {
148
'Content-type': 'application/json',
159
},

Diff for: src/api/games/deleteGameParticipate.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ export const deleteGameParticipate = async ({
66
gameId,
77
memberId,
88
}: DeleteGameParticipateRequest) => {
9-
await axiosInstance.delete(`/api/games/${gameId}/members/${memberId}`, {});
9+
await axiosInstance.delete(`/games/${gameId}/members/${memberId}`, {});
1010
};

Diff for: src/api/games/getGameDetail.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Game } from '@type/models';
55

66
export const getGameDetail = async ({ gameId }: { gameId: Game['id'] }) => {
77
const { data } = await axiosInstance.get<GetGameDetailResponse>(
8-
`api/games/${gameId}`,
8+
`/games/${gameId}`,
99
{}
1010
);
1111

Diff for: src/api/games/getGameMembers.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const getGameMembers = async ({
1313
status,
1414
}: getGameMembersProps) => {
1515
const { data } = await axiosInstance.get<GetGameMembersResponse>(
16-
`/api/games/${gameId}/members`,
16+
`/games/${gameId}/members`,
1717
{
1818
params: { status },
1919
}

Diff for: src/api/games/getGames.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const getGames = async ({
1313
page: number;
1414
size: number;
1515
}) => {
16-
const { data } = await axiosInstance.get<GetGamesResponse>('/api/games', {
16+
const { data } = await axiosInstance.get<GetGamesResponse>('/games', {
1717
params: { category, value, page, size },
1818
});
1919

Diff for: src/api/games/patchGameParticipate.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const patchMannerScoreReview = async ({
1212
gameId: Game['id'];
1313
memberId: Member['id'];
1414
}) => {
15-
await axiosInstance.patch(`api/games/${gameId}/members/${memberId}`, {
15+
await axiosInstance.patch(`/games/${gameId}/members/${memberId}`, {
1616
data: payload,
1717
});
1818
return;

Diff for: src/api/games/patchMannerScoreReview.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const patchMannerScoreReview = async ({
1010
payload: PatchGameMannerScoreReviewRequest;
1111
gameId: Game['id'];
1212
}) => {
13-
await axiosInstance.patch(`api/games/${gameId}/members/manner-scores`, {
13+
await axiosInstance.patch(`/games/${gameId}/members/manner-scores`, {
1414
data: payload,
1515
});
1616
return;

Diff for: src/api/games/postGame.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { axiosInstance } from '@api/axiosInstance';
33
import { PostGameRequest, PostGameResponse } from '@type/api/games';
44

55
export const postGame = async (payload: PostGameRequest) => {
6-
const { data } = await axiosInstance.post<PostGameResponse>('/api/games', {
6+
const { data } = await axiosInstance.post<PostGameResponse>('/games', {
77
data: payload,
88
});
99

Diff for: src/api/games/postGameParticipate.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const postGameParticipate = async ({
1010
payload: PostGameParticipateRequest;
1111
gameId: Game['id'];
1212
}) => {
13-
await axiosInstance.post(`/api/games/${gameId}/members`, {
13+
await axiosInstance.post(`/games/${gameId}/members`, {
1414
data: payload,
1515
});
1616
};

Diff for: src/components/shared/AllowCard/AllowCard.style.ts renamed to src/components/AllowCard/AllowCard.style.ts

-6
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,3 @@ export const FlexBox = styled.div`
1414
display: flex;
1515
gap: 0.31rem;
1616
`;
17-
18-
export const AllowCardGroupContainer = styled.div`
19-
display: flex;
20-
flex-wrap: wrap;
21-
gap: 0.75rem;
22-
`;

Diff for: src/components/shared/AllowCard/AllowCard.tsx renamed to src/components/AllowCard/AllowCard.tsx

+15-16
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import { useNavigate } from 'react-router-dom';
2-
3-
import { Avatar } from '@components/shared/Avatar';
1+
import { Avatar } from '@components/Avatar';
42
import { Button } from '@components/shared/Button';
53
import { Text } from '@components/shared/Text';
64

@@ -12,6 +10,7 @@ import { AllowCardContainer, FlexBox } from './AllowCard.style';
1210

1311
type AllowCardProps = {
1412
player: Player;
13+
moveToProfile: (path: string) => void;
1514
};
1615

1716
type Player = {
@@ -28,11 +27,9 @@ const buttonOverlappedProps = {
2827
backgroundColor: 'white',
2928
};
3029

31-
export const AllowCard = ({ player }: AllowCardProps) => {
32-
const navigate = useNavigate();
33-
34-
const moveToProfile = () => {
35-
navigate(PATH_NAME.GET_PROFILE_PATH(player.id));
30+
export const AllowCard = ({ player, moveToProfile }: AllowCardProps) => {
31+
const handleClickProfile = () => {
32+
moveToProfile(PATH_NAME.GET_PROFILE_PATH(player.id));
3633
};
3734

3835
const handleAllowClick = () => {};
@@ -45,33 +42,35 @@ export const AllowCard = ({ player }: AllowCardProps) => {
4542
<Avatar
4643
src={player.profileImageUrl}
4744
size={40}
48-
onClick={moveToProfile}
45+
onClick={handleClickProfile}
4946
/>
5047
<Text
5148
size="1rem"
5249
weight={500}
5350
lineHeight="40px"
5451
ellipsis={1}
55-
onClick={moveToProfile}
52+
onClick={handleClickProfile}
5653
>
5754
{player.nickname}
5855
</Text>
5956
</FlexBox>
6057
<FlexBox>
6158
<Button
62-
text="수락"
6359
textColor={theme.PALETTE.RED_400}
6460
borderColor={theme.PALETTE.RED_400}
65-
handleClick={handleAllowClick}
61+
onClick={handleAllowClick}
6662
{...buttonOverlappedProps}
67-
/>
63+
>
64+
수락
65+
</Button>
6866
<Button
69-
text="거절"
7067
textColor={theme.PALETTE.GRAY_400}
7168
borderColor={theme.PALETTE.GRAY_400}
72-
handleClick={handleRejectClick}
69+
onClick={handleRejectClick}
7370
{...buttonOverlappedProps}
74-
/>
71+
>
72+
거절
73+
</Button>
7574
</FlexBox>
7675
</AllowCardContainer>
7776
);

Diff for: src/components/AllowCard/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './AllowCard';
File renamed without changes.
File renamed without changes.

Diff for: src/components/shared/AvatarGroup/AvatarGroup.styles.ts renamed to src/components/AvatarGroup/AvatarGroup.styles.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import styled from '@emotion/styled';
22

3-
import { Avatar, AvatarProps } from '@components/shared/Avatar';
3+
import { Avatar, AvatarProps } from '@components/Avatar';
44

55
import { AvatarGroupProps } from './AvatarGroup';
66

7-
type AvatarGroupWrapperProps = Required<Pick<AvatarGroupProps, 'overlap'>>;
7+
type AvatarContainerProps = Required<Pick<AvatarGroupProps, 'overlap'>>;
88

9-
export const AvatarGroupWrapper = styled.div<AvatarGroupWrapperProps>`
9+
export const AvatarContainer = styled.div<AvatarContainerProps>`
1010
padding-left: ${({ overlap }) => `${overlap / 16}rem`};
1111
`;
1212

Diff for: src/components/shared/AvatarGroup/AvatarGroup.tsx renamed to src/components/AvatarGroup/AvatarGroup.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { HTMLAttributes } from 'react';
22

33
import { Avatar, AvatarProps } from '../Avatar';
4-
import { AvatarGroupWrapper, OverlapedAvatar } from './AvatarGroup.styles';
4+
import { AvatarContainer, OverlapedAvatar } from './AvatarGroup.styles';
55

66
export type AvatarGroupProps = {
77
children: React.ReactNode;
@@ -39,8 +39,8 @@ export const AvatarGroup = ({
3939
));
4040

4141
return (
42-
<AvatarGroupWrapper overlap={overlap} {...props}>
42+
<AvatarContainer overlap={overlap} {...props}>
4343
{avatars}
44-
</AvatarGroupWrapper>
44+
</AvatarContainer>
4545
);
4646
};
File renamed without changes.

Diff for: src/components/Button/Button.tsx

Whitespace-only changes.

Diff for: src/components/Button/index.ts

Whitespace-only changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Diff for: src/components/shared/MatchItem/MatchItem.tsx renamed to src/components/MatchItem/MatchItem.tsx

+3-29
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
import { ButtonHTMLAttributes, PropsWithChildren } from 'react';
1+
import { PropsWithChildren } from 'react';
22
import { useNavigate } from 'react-router-dom';
33

4-
import styled from '@emotion/styled';
5-
6-
import { Button } from '@components/shared/Button';
7-
84
import { theme } from '@styles/theme';
95

106
import { PATH_NAME } from '@consts/pathName';
@@ -24,29 +20,7 @@ import {
2420
MatchStartTime,
2521
MatchStatus,
2622
} from './MatchItem.styles';
27-
28-
type MatchItemBtnProps = {
29-
text: string;
30-
onClick: React.MouseEventHandler<HTMLButtonElement>;
31-
} & ButtonHTMLAttributes<HTMLButtonElement>;
32-
33-
const StyledButton = styled(Button)`
34-
border-radius: 8px;
35-
padding: 10px;
36-
font-size: 1rem;
37-
font-family: 'GmarketSans';
38-
`;
39-
40-
const BottomBtn = ({ onClick, text, ...props }: MatchItemBtnProps) => {
41-
return (
42-
<StyledButton
43-
{...theme.BUTTON_PROPS.LARGE_RED_BUTTON_PROPS}
44-
text={text}
45-
onClick={onClick}
46-
{...props}
47-
/>
48-
);
49-
};
23+
import { BottomButton } from './components/BottomButton';
5024

5125
type MatchItemProps = {
5226
matchId: string;
@@ -117,6 +91,6 @@ const MatchItem = ({
11791
);
11892
};
11993

120-
MatchItem.BottomBtn = BottomBtn;
94+
MatchItem.BottomButton = BottomButton;
12195

12296
export { MatchItem };
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import styled from '@emotion/styled';
2+
3+
import { Button } from '@components/shared/Button';
4+
5+
export const StyledButton = styled(Button)`
6+
border-radius: 8px;
7+
padding: 10px;
8+
font-size: 1rem;
9+
font-family: 'GmarketSans';
10+
`;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { theme } from '@styles/theme';
2+
3+
import { StyledButton } from './BottomButton.styles';
4+
5+
export const BottomButton = ({
6+
children,
7+
onClick,
8+
...props
9+
}: React.ComponentProps<'button'>) => {
10+
return (
11+
<StyledButton
12+
{...theme.BUTTON_PROPS.LARGE_RED_BUTTON_PROPS}
13+
onClick={onClick}
14+
{...props}
15+
>
16+
{children}
17+
</StyledButton>
18+
);
19+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './BottomButton';
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Diff for: src/components/shared/AllowCard/AllowCardGroup.tsx

-8
This file was deleted.

Diff for: src/components/shared/AllowCard/index.ts

-2
This file was deleted.

Diff for: src/components/shared/Button/Button.tsx

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
1+
import { PropsWithChildren } from 'react';
2+
13
import { StyledButton } from './Button.styles';
24

3-
export type ButtonProps = {
5+
export type ButtonProps = PropsWithChildren<{
46
width: string;
57
height: string;
6-
text: string;
78
fontSize?: number | string;
89
fontWeight: number;
910
lineHeight?: number | string;
1011
textColor: string;
1112
borderColor?: string;
1213
backgroundColor: string;
13-
handleClick: () => void;
14-
};
14+
}> &
15+
React.ComponentProps<'button'>;
1516

16-
export const Button = (props: ButtonProps) => {
17+
export const Button = ({ onClick, ...props }: ButtonProps) => {
18+
const { children } = props;
1719
return (
18-
<StyledButton onClick={props.handleClick} {...props}>
19-
{props.text}
20+
<StyledButton onClick={onClick} {...props}>
21+
{children}
2022
</StyledButton>
2123
);
2224
};

Diff for: src/components/shared/Text/Text.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { LINE_HEIGHT } from '@styles/font';
55
import { StyledParagraph } from './Text.styles';
66

77
type Textprops = {
8-
children: string;
8+
children: React.ReactNode;
99
size?: number | string;
1010
weight?: 300 | 500 | 700;
1111
lineHeight?: string;

Diff for: src/components/shared/VirtualScroll/VirtualScroll.styles.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import styled from '@emotion/styled';
22

3-
export const StyledVirtualScrollWrapper = styled.div<{ width: string }>`
3+
export const StyledVirtualScrollContainer = styled.div<{ width: string }>`
44
width: ${({ width }) => width};
5-
height: 8rem;
5+
height: 13rem;
66
overflow: auto;
77
&::-webkit-scrollbar {
88
display: none;

0 commit comments

Comments
 (0)