Skip to content

Commit f7ef57f

Browse files
authored
Merge pull request #68 from Leets-Official/67-refactor/컴포넌트-리팩토링
[Refactor] 컴포넌트 리팩토링
2 parents f9de8ab + 849e64e commit f7ef57f

46 files changed

Lines changed: 1843 additions & 569 deletions

Some content is hidden

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

src/app/routes.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ export default [
77
index('routes/(main)/_index.tsx'),
88
route('sell', 'routes/(main)/sell.tsx'),
99
route('sell/confirm', 'routes/(main)/sell.confirm.tsx'),
10-
route('mypage', 'routes/mypage.tsx'),
11-
route('mypage/settings', 'routes/mypage-settings.tsx'),
12-
route('mypage/profile', 'routes/mypage-profile.tsx'),
10+
route('mypage', 'routes/(main)/mypage.tsx'),
11+
route('mypage/settings', 'routes/(main)/mypage.settings.tsx'),
12+
route('mypage/profile', 'routes/(main)/mypage.profile.tsx'),
1313
]),
14-
route('playground', 'routes/playground.tsx'),
1514
] satisfies RouteConfig;

src/app/routes/playground.tsx

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/pages/login/ui/LoginPage.styles.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
export const loginStyles = {
22
wrapper: `
3-
w-screen h-screen
3+
min-w-[111.2vw] min-h-[111.2vh]
44
flex items-center justify-center
5-
bg-cover bg-no-repeat
6-
overflow-x-hidden
5+
bg-cover bg-no-repeat bg-center
6+
overflow-hidden
77
`,
88

99
greeting: `

src/pages/main/ui/MainPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default function MainPage() {
1111
const navigate = useNavigate();
1212

1313
return (
14-
<main className="flex w-full flex-col items-center gap-14 px-4 pb-24">
14+
<main className="flex w-full flex-col items-center gap-[68px] px-4 pb-24">
1515
<section className="h-79.25 w-full max-w-300" aria-label="메인 슬로건 영역">
1616
<ClientOnly>
1717
<Carousel3D slides={CAROUSEL_SLIDES} />
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { getStatusCount } from './filterTradeItems';
2+
import type { StatusTabLabels, StatusTabs } from './types';
3+
import type { TradeListItem } from '@pages/mypage/ui/TradeItemList';
4+
5+
export const createStatusTabs = (items: TradeListItem[], labels: StatusTabLabels): StatusTabs => [
6+
{ id: 'all', label: '전체', count: getStatusCount(items, 'all') },
7+
{ id: 'buying', label: labels.buying, count: getStatusCount(items, 'buying') },
8+
{ id: 'completed', label: labels.completed, count: getStatusCount(items, 'completed') },
9+
];
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import type { StatusFilter } from './types';
2+
import type { TradeListItem } from '@pages/mypage/ui/TradeItemList';
3+
4+
export const filterTradeItems = (items: TradeListItem[], status: StatusFilter): TradeListItem[] => {
5+
if (status === 'all') {
6+
return items;
7+
}
8+
if (status === 'buying') {
9+
return items.filter((item) => item.status === 'buying' || item.status === 'reserved');
10+
}
11+
return items.filter((item) => item.status === status);
12+
};
13+
14+
export const getStatusCount = (items: TradeListItem[], status: StatusFilter): number => {
15+
return filterTradeItems(items, status).length;
16+
};

src/pages/mypage/model/types.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import type { CommonTabItem } from '@pages/mypage/ui/CommonTabs';
2+
import type { TradeListItem } from '@pages/mypage/ui/TradeItemList';
3+
4+
export type MainTabId = 'buy' | 'sell' | 'favorite';
5+
6+
export type StatusFilter = 'all' | 'buying' | 'completed';
7+
8+
export type FavoriteCategory = 'product' | 'repair';
9+
10+
export type StatusTabLabels = {
11+
buying: string;
12+
completed: string;
13+
};
14+
15+
export type CreateStatusTabsParams = {
16+
items: TradeListItem[];
17+
labels: StatusTabLabels;
18+
};
19+
20+
export type StatusTabs = Array<CommonTabItem<StatusFilter>>;
21+
22+
export type FavoriteTabs = Array<CommonTabItem<FavoriteCategory>>;

0 commit comments

Comments
 (0)