Skip to content

Commit

Permalink
๐Ÿ› ๏ธ refactor: ํŒŒ์ผ ์ปจ๋ฒค์…˜ (#35)
Browse files Browse the repository at this point in the history
* refactor: api ๋„ค์ด๋ฐ ์ˆ˜์ •

* fix: jsx single quote

* fix: ์ปดํฌ๋„ŒํŠธ ํŒŒ์ผ๋ช…

* fix: component alias ์ ์šฉ

* fix: meetingRoom ํŽ˜์ด์ง€ ๋„ค์ด๋ฐ ์ปจ๋ฒค์…˜ ํ†ต์ผ

* fix: alias, double qoute

* chore: delete meetingroom directory
  • Loading branch information
kongnayeon authored Mar 3, 2024
1 parent 4f88471 commit bbaaefe
Show file tree
Hide file tree
Showing 27 changed files with 52 additions and 55 deletions.
6 changes: 3 additions & 3 deletions src/apis/user/userApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ import { api } from '../axois';

export const userApi = {
// ์นด์นด์˜ค ๋กœ๊ทธ์ธ
kakaoLogin: `${BASE_URL}/oauth2/authorization/kakao?redirect_uri=${REDIRECT_URI}`,
GET_KAKAO_LOGIN: `${BASE_URL}/oauth2/authorization/kakao?redirect_uri=${REDIRECT_URI}`,
// ์œ ์ € ์กฐํšŒ
getInfo: (token: string) =>
GET_MEMBERS: (token: string) =>
api.get('/api/members', {
headers: {
Authorization: token
}
}),
// ๋‹‰๋„ค์ž„ ์ถ”๊ฐ€
addNickname: (nickname: string, token: string) =>
PATCH_NICKNAME: (nickname: string, token: string) =>
api.patch(
'/api/members/nickname',
{ nickname },
Expand Down
12 changes: 7 additions & 5 deletions src/components/common/Button/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { KeyOfPalette } from '@/styles';
import styled from '@emotion/styled';
import { Size, BackgroundColor, TextColor } from './types';

export type Size = 'lg' | 'md' | 'sm';

interface ButtonProps {
children: React.ReactNode;
size: Size;
fullWidth?: boolean;
backgroundColor: BackgroundColor;
textColor?: TextColor;
backgroundColor: KeyOfPalette;
textColor?: KeyOfPalette;
disabled?: boolean;
onClick: () => void;
}
Expand Down Expand Up @@ -36,8 +38,8 @@ export const Button = ({
const StyledButton = styled.button<{
size: 'lg' | 'md' | 'sm';
fullWidth?: boolean;
backgroundColor: BackgroundColor;
textColor: TextColor;
backgroundColor: KeyOfPalette;
textColor: KeyOfPalette;
disabled?: boolean;
}>`
${(props) =>
Expand Down
1 change: 0 additions & 1 deletion src/components/common/Button/index.ts

This file was deleted.

9 changes: 0 additions & 9 deletions src/components/common/Button/types/index.d.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/common/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import styled from '@emotion/styled';
import { SvgIcon } from '../SvgIcon';
import { SvgIcon } from '@/components/common/SvgIcon/SvgIcon';

interface HeaderProps {
title?: string;
Expand Down
1 change: 0 additions & 1 deletion src/components/common/Header/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable prettier/prettier */
/* eslint-disable react/display-name */
/* eslint-disable @typescript-eslint/no-unused-vars */
import {
Expand All @@ -10,7 +11,7 @@ import styled from '@emotion/styled';
import { theme } from '@/styles';
import { Flex } from '@/components/Wrapper';
import { css } from '@emotion/react';
import { SvgIcon } from './SvgIcon';
import { SvgIcon } from '../SvgIcon/SvgIcon';

export type InputVariant = 'default' | 'join' | 'meeting';

Expand Down
4 changes: 1 addition & 3 deletions src/components/common/Modal/MordalPortal.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { ReactNode } from 'react';
import reactDom from 'react-dom';

const ModalPortal = ({ children }: { children: ReactNode }) => {
export const ModalPortal = ({ children }: { children: ReactNode }) => {
const el = document.getElementById('modal');
if (!el) return null;
return reactDom.createPortal(children, el);
};

export default ModalPortal;
1 change: 0 additions & 1 deletion src/components/common/SvgIcon/index.ts

This file was deleted.

8 changes: 8 additions & 0 deletions src/components/common/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export * from './BottomSheet/GlobalBottomSheet';
export * from './Button/Button';
export * from './Header/Header';
export * from './Input/Input';
export * from './Modal/MeetingRoomModal';
export * from './Modal/MordalPortal';
export * from './SvgIcon/SvgIcon';
export * from './TimePicker/TimePicker';
Empty file.
2 changes: 2 additions & 0 deletions src/components/layout/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './Layout';
export * from './LoginLayout';
3 changes: 0 additions & 3 deletions src/components/layout/index.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/meetingRoom/AgendaCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { BreakTime, BreakTimeDisabled } from '@/assets/BreakTime';
import { Flex, Space, Text } from '@/components/Wrapper';
import { theme } from '@/styles';
import styled from '@emotion/styled';
import { SvgIcon } from '@/components/common/SvgIcon';
import { SvgIcon } from '@/components/common/SvgIcon/SvgIcon';
import { css } from '@emotion/react';

interface AgendaCardProps {
Expand Down
2 changes: 1 addition & 1 deletion src/components/meetingRoom/MeetingCard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Flex, Space, Text } from '@/components/Wrapper';
import { SvgIcon } from '@/components/common/SvgIcon';
import { SvgIcon } from '@/components/common/SvgIcon/SvgIcon';
import { theme } from '@/styles';
import { keyframes } from '@emotion/react';
import styled from '@emotion/styled';
Expand Down
2 changes: 1 addition & 1 deletion src/components/meetingRoom/TimeLineButton.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Text } from '@/components/Wrapper';
import { SvgIcon } from '@/components/common/SvgIcon';
import { SvgIcon } from '@/components/common/SvgIcon/SvgIcon';
import { theme } from '@/styles';
import styled from '@emotion/styled';
import { ButtonHTMLAttributes } from 'react';
Expand Down
4 changes: 4 additions & 0 deletions src/components/meetingRoom/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from './timer/Timer';
export * from './AgendaCard';
export * from './MeetingCard';
export * from './TimeLineButton';
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import styled from '@emotion/styled';
import { formatSeconds } from '../../utils/formatSeconds';
import { formatSeconds } from '@/utils';
import {
ColorFormat,
CountdownCircleTimer
Expand Down
2 changes: 1 addition & 1 deletion src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Global, ThemeProvider } from '@emotion/react';
import { theme } from './styles/theme';
import { Routers } from '@/routes/index.tsx';
import { Layout } from '@/components/layout';
import { GlobalBottomSheet } from '@/components/bottomSheet/GlobalBottomSheet';
import { GlobalBottomSheet } from '@/components/common/BottomSheet/GlobalBottomSheet';

const queryClient = new QueryClient({
defaultOptions: {
Expand Down
3 changes: 1 addition & 2 deletions src/pages/join/complete.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { IconJoinComplete } from '@/assets/IconJoinComplete';
import { Space } from '@/components/Wrapper';
import { Button } from '@/components/common/Button';
import { Header } from '@/components/common/Header';
import { Button, Header } from '@/components/common';
import { media } from '@/styles';
import styled from '@emotion/styled';
import { useNavigate } from 'react-router-dom';
Expand Down
8 changes: 3 additions & 5 deletions src/pages/join/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { userApi } from '@/apis/user';
import { Space } from '@/components/Wrapper';
import { Button } from '@/components/common/Button';
import { Header } from '@/components/common/Header';
import { Input } from '@/components/common/Input';
import { Button, Header, Input } from '@/components/common';
import { media } from '@/styles';
import styled from '@emotion/styled';
import { useEffect } from 'react';
Expand Down Expand Up @@ -31,7 +29,7 @@ const Join = () => {

if (token) {
try {
await userApi.addNickname(nickname, token);
await userApi.PATCH_NICKNAME(nickname, token);
document.cookie = `token=${token}`;
navigate('/join/complete');
} catch {
Expand All @@ -45,7 +43,7 @@ const Join = () => {
const getUserData = async () => {
if (token) {
try {
const { data } = await userApi.getInfo(token);
const { data } = await userApi.GET_MEMBERS(token);
const nickname = data?.response?.nickname;
setValue('join', nickname);
} catch {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import { ButtonWrapper, Flex, Space, Text } from '@/components/Wrapper';
import { Button } from '@/components/common/Button';
import { Header } from '@/components/common/Header';
import { Input } from '@/components/common/Input';
import { MeetingRoomModal } from '@/components/common/Modal/MeetingRoomModal';
import ModalPortal from '@/components/common/Modal/MordalPortal';
import {
Button,
Header,
Input,
MeetingRoomModal,
ModalPortal,
TimePicker,
TimePickerValueGroups
} from '@/components/common/TimePicker/TimePicker';
import { AgendaCard } from '@/components/meetingRoom/AgendaCard';
import { MeetingCard } from '@/components/meetingRoom/MeetingCard';
import { TimeLineButton } from '@/components/meetingRoom/TimeLineButton';
} from '@/components/common';
import {
AgendaCard,
MeetingCard,
TimeLineButton
} from '@/components/meetingRoom';
import useBottomSheet from '@/hooks/useBottomSheet';
import { media, theme } from '@/styles';
import styled from '@emotion/styled';
Expand Down
4 changes: 2 additions & 2 deletions src/pages/onboarding/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { userApi } from '@/apis/user';
import { IconOnboardingBackground } from '@/assets/IconOnboardingBackground';
import { SvgIcon } from '@/components/common/SvgIcon';
import { SvgIcon } from '@/components/common';
import { media } from '@/styles';
import styled from '@emotion/styled';
import { Link } from 'react-router-dom';
Expand All @@ -12,7 +12,7 @@ const Onboarding = () => {
<IconOnboardingBackground />
</StyledGraphic>

<Link to={userApi.kakaoLogin}>
<Link to={userApi.GET_KAKAO_LOGIN}>
<StyledButton>
<SvgIcon id="kakao" /> ์นด์นด์˜ค๋กœ ๊ณ„์†ํ•˜๊ธฐ
</StyledButton>
Expand Down
4 changes: 2 additions & 2 deletions src/routes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import App from '@/App';
import { LoginLayout } from '@/components/layout';
import Join from '@/pages/join';
import JoinComplete from '@/pages/join/complete';
import { MeetingRoom } from '@/pages/meetingroom';
import { MeetingRoom } from '@/pages/meetingRoom';
import Onboarding from '@/pages/onboarding';

import {
Expand Down Expand Up @@ -37,7 +37,7 @@ const routeChildren: RouteChildren[] = [
auth: false
},
{
path: '/meetingroom/:meetingId',
path: '/meeting-room/:meetingId',
element: <MeetingRoom />,
auth: true
}
Expand Down
1 change: 0 additions & 1 deletion src/store/bottomSheet.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { ReactNode } from 'react';
import { atom } from 'recoil';

Expand Down

0 comments on commit bbaaefe

Please sign in to comment.