Skip to content

Commit

Permalink
refactor: prettier printWidth 적용 & build error 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
hyeseon-han committed Feb 28, 2024
1 parent 34a2bd5 commit 74224cf
Show file tree
Hide file tree
Showing 41 changed files with 146 additions and 583 deletions.
5 changes: 1 addition & 4 deletions src/api/axiosInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ axiosInstance.interceptors.response.use(
if (error.response?.status === 401 && !originalRequest._retry) {
originalRequest._retry = true;

const refreshToken =
typeof window !== 'undefined'
? localStorage.getItem('refreshToken')
: null;
const refreshToken = typeof window !== 'undefined' ? localStorage.getItem('refreshToken') : null;

try {
originalRequest.headers['Refresh-Token'] = refreshToken;
Expand Down
5 changes: 1 addition & 4 deletions src/components/atoms/Container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ interface ContainerProps {

const Container: React.FC<ContainerProps> = ({ children, className, id }) => {
return (
<div
id={id}
className={`flex flex-col justify-center items-center gap-22 p-32 w-full rounded-12 ${className}`}
>
<div id={id} className={`flex flex-col justify-center items-center gap-22 p-32 w-full rounded-12 ${className}`}>
{children}
</div>
);
Expand Down
5 changes: 1 addition & 4 deletions src/components/atoms/IngredientDateTag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ const IngredientDateTag: React.FC<IngredientDateTagProps> = ({ dDay }) => {
}

return (
<div
className={`min-w-[64px] p-9 rounded-6 text-center body1-semibold ${className}`}
style={{ backgroundColor }}
>
<div className={`min-w-[64px] p-9 rounded-6 text-center body1-semibold ${className}`} style={{ backgroundColor }}>
{textDay}
</div>
);
Expand Down
10 changes: 1 addition & 9 deletions src/components/atoms/Lottie.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,7 @@ import animationData from './../../assets/lottie.webp';
import Image from 'next/image';

const LottieComponent = () => {
return (
<Image
className="m-auto"
src={animationData}
alt="로딩중"
width={167}
height={156}
/>
);
return <Image className="m-auto" src={animationData} alt="로딩중" width={167} height={156} />;
};

export default LottieComponent;
5 changes: 1 addition & 4 deletions src/components/molecules/FridgeListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ const FridgeListItem: React.FC<FridgeListItemProps> = ({
};

return (
<GrayBox
className="flex-row items-center justify-between h-[70px]"
onClick={onClick}
>
<GrayBox className="flex-row items-center justify-between h-[70px]" onClick={onClick}>
<div className="flex gap-[9px] items-center">
{isEditingFridgeName && id === newFridgeName.id ? (
<input
Expand Down
17 changes: 3 additions & 14 deletions src/components/organisms/FridgeBoard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@ import React, { useRef, useState } from 'react';
import { Container, Lottie } from '@/components/atoms';
import { EmptyBox, FridgeTab, IngredientItemBox } from '@/components/molecules';
import { IngredientModal } from '.';
import {
Modal,
ModalOverlay,
ModalBody,
ModalContent,
useDisclosure,
} from '@chakra-ui/react';
import { Modal, ModalOverlay, ModalBody, ModalContent, useDisclosure } from '@chakra-ui/react';
import { useGetFridgeContentById } from '@/hooks/queries/fridge';
import { useObserver } from '@/hooks/useObserver';
import { useRouter } from 'next/router';
Expand Down Expand Up @@ -86,10 +80,7 @@ const FridgeBoard: React.FC = () => {
</Modal>
)}
<Container className="p-[20px] bg-white">
<FridgeTab
currentTabName={currentTabName}
handleTabNameChange={handleTabNameChange}
/>
<FridgeTab currentTabName={currentTabName} handleTabNameChange={handleTabNameChange} />
<div className="flex flex-col w-full gap-[24px]">
{ingredients?.pages.map(({ content }) =>
content && content.length > 0 ? (
Expand All @@ -102,9 +93,7 @@ const FridgeBoard: React.FC = () => {
))
) : (
<div>
<EmptyBox
text={`${currentTabName}칸에 추가된 식자재가 없어요!`}
/>
<EmptyBox text={`${currentTabName}칸에 추가된 식자재가 없어요!`} />
</div>
),
)}
Expand Down
20 changes: 4 additions & 16 deletions src/components/organisms/FridgeInfoBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,18 @@ const FridgeInfoBox: React.FC<{
return (
<div className="flex justify-between items-end mb-[28px]">
<div className="flex flex-col gap-[12px]">
<div className="body1-medium text-gray7">
{userName ?? '사용자정보없음'} 님의
</div>
<div
className="flex items-center gap-[8px]"
onClick={toggleIsOpenFridgeListModal}
>
<div className="body1-medium text-gray7">{userName ?? '사용자정보없음'} 님의</div>
<div className="flex items-center gap-[8px]" onClick={toggleIsOpenFridgeListModal}>
<div className="heading1-bold">{name ?? '냉장고를 선택해주세요'}</div>
<AngleIcon
width={16}
height={16}
fill="#000000"
transform="rotate(-90)"
/>
<AngleIcon width={16} height={16} fill="#000000" transform="rotate(-90)" />
</div>
</div>
{isOkIngredientAdd && (
<Button
className="rounded-6 w-[100px] p-[10px] body1-semibold bg-primary2 text-white"
text="식자재 추가"
onClick={() => {
void router.push(
`/fridge/add?fridgeid=${fridgeid as string}&name=${name as string}`,
);
void router.push(`/fridge/add?fridgeid=${fridgeid as string}&name=${name as string}`);
}}
/>
)}
Expand Down
13 changes: 3 additions & 10 deletions src/components/organisms/FridgeListModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ const FridgeListModal: React.FC<{

const handleFridgeClick = (id: number, name: string) => {
void router.push(
ownerId
? `/friend/${ownerId}?fridgeid=${id}&name=${name}`
: `fridge/?fridgeid=${id}&name=${name}`,
ownerId ? `/friend/${ownerId}?fridgeid=${id}&name=${name}` : `fridge/?fridgeid=${id}&name=${name}`,
);
onCloseFridgeListModal();
};
Expand All @@ -58,9 +56,7 @@ const FridgeListModal: React.FC<{
<ModalContainer>
<div>
<div className="heading2-bold">냉장고 목록</div>
<div className="body2-medium text-gray5">
자유롭게 여러 냉장고를 정리할 수 있어요
</div>
<div className="body2-medium text-gray5">자유롭게 여러 냉장고를 정리할 수 있어요</div>
</div>
<div className="flex flex-col gap-[10px] mt-[25px] mb-[32px]">
{fridgeList?.map(({ id, name }) => (
Expand Down Expand Up @@ -91,10 +87,7 @@ const FridgeListModal: React.FC<{
</div>
<div className="flex w-full gap-[8px]">
{!ownerId && (
<button
className="p-[13px] border-2 rounded-[12px]"
onClick={handleDeleteFridgeClick}
>
<button className="p-[13px] border-2 rounded-[12px]" onClick={handleDeleteFridgeClick}>
<TrashcanIcon />
</button>
)}
Expand Down
21 changes: 3 additions & 18 deletions src/components/organisms/FriendsFridgeList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,15 @@ const FriendsFridgeList: React.FC<{
<div className="heading2-semibold text-gray8">
친구 목록 <span className="heading2-bold text-primary3">{count}</span>
</div>
<div
className="flex items-center gap-[6px]"
onClick={toggleIsOpenOrderListModal}
>
<div className="flex items-center gap-[6px]" onClick={toggleIsOpenOrderListModal}>
<div>등록순</div>
<AngleIcon
width={14}
height={14}
fill="#9299AA"
transform="rotate(-90)"
/>
<AngleIcon width={14} height={14} fill="#9299AA" transform="rotate(-90)" />
</div>
</div>
<Container className="bg-white">
<div className="w-full flex flex-col gap-[24px]">
{data && data.length !== 0 ? (
data.map((friend) => (
<FriendsFridgeItem
key="김지수"
name="김지수"
ingredientCount={13}
linkTo="#"
/>
))
data.map((friend) => <FriendsFridgeItem key="김지수" name="김지수" ingredientCount={13} linkTo="#" />)
) : (
<EmptyBox text="추가된 친구가 없어요!" />
)}
Expand Down
30 changes: 8 additions & 22 deletions src/components/organisms/FriendsRecentBoard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import Link from 'next/link';
import type { FriendObjectType } from '@/hooks/queries/friends/useGetFriendsNews';
import Image from 'next/image';

const FriendsRecentBoard: React.FC<{ friendNews: FriendObjectType }> = ({
friendNews,
}) => {
const FriendsRecentBoard: React.FC<{ friendNews: FriendObjectType }> = ({ friendNews }) => {
return (
<Container className="flex bg-white gap-[12px]">
<div className="text-primary2 body2-semibold">최신근황</div>
Expand All @@ -15,26 +13,14 @@ const FriendsRecentBoard: React.FC<{ friendNews: FriendObjectType }> = ({
<br />
{friendNews.friendRefrigeratorIngredientGroupList[0].name}를 추가했어요!
</div>
<div className="text-gray6 body2-medium">
그밖에 신선한 재료를 구경할 수 있어요.
</div>
<div className="text-gray6 body2-medium">그밖에 신선한 재료를 구경할 수 있어요.</div>
<div className="flex w-full justify-center gap-[6px]">
{friendNews.friendRefrigeratorIngredientGroupList.map(
({ name, iconImage }) => (
<div
key={name}
className={`flex flex-col items-center bg-gray1 p-[12px] rounded-[12px]`}
>
<Image
src={iconImage}
alt={`${name} 아이콘 이미지`}
width={50}
height={50}
/>
<div className={`body2-medium text-gray7`}>{name}</div>
</div>
),
)}
{friendNews.friendRefrigeratorIngredientGroupList.map(({ name, iconImage }) => (
<div key={name} className={`flex flex-col items-center bg-gray1 p-[12px] rounded-[12px]`}>
<Image src={iconImage} alt={`${name} 아이콘 이미지`} width={50} height={50} />
<div className={`body2-medium text-gray7`}>{name}</div>
</div>
))}
</div>
<Link
className="w-full"
Expand Down
Loading

0 comments on commit 74224cf

Please sign in to comment.