Skip to content

Commit 9541efe

Browse files
authored
Merge pull request #277 from boostcampwm-2024/dev-front
[FE] Merge to main
2 parents 5efb23a + d6b1100 commit 9541efe

File tree

10 files changed

+29
-25
lines changed

10 files changed

+29
-25
lines changed
-13.5 KB
Loading

frontend/src/component/molecule/NavbarMenu.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ export default function NavbarMenu() {
1212
return (
1313
<Link to={item.path}>
1414
<div
15-
className={`flex cursor-pointer items-center gap-4 md:gap-[8px] ${
15+
className={`flex cursor-pointer items-center gap-4 ${
1616
isActive
1717
? 'dark:text-white dark:hover:text-white'
1818
: 'text-gray hover:text-black dark:hover:text-white'
1919
}`}>
2020
<Img
2121
src={isActive ? item.activeIcon : item.inactiveIcon}
2222
alt={`${item.label} 아이콘`}
23-
cssOption='w-4 md:w-6'
23+
cssOption='w-4'
2424
/>
2525
<P content={item.label} cssOption='text-[1vw] trunacte' />
2626
</div>

frontend/src/component/molecule/NavbarTitle.tsx

+2-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@ export default function NavbarTitle() {
1111
};
1212

1313
return (
14-
<div className='w-full'>
15-
<div
16-
className='flex min-w-0 cursor-pointer items-center gap-2 md:gap-4'
17-
onClick={navigateMain}>
14+
<div className='my-2 w-full'>
15+
<div className='flex min-w-0 cursor-pointer items-center gap-2' onClick={navigateMain}>
1816
<Img src={FaviconImg} cssOption='w-[36px]' alt='와치덕스 로고 이미지' />
1917
<H1 cssOption='font-bold text-[1.6vw] truncate dark:text-white' content='WatchDucks' />
2018
</div>

frontend/src/component/molecule/RankingItem.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ import { useNavigate } from 'react-router-dom';
88

99
type Props = {
1010
data: RankingData;
11+
unit: string;
1112
};
1213

13-
export default function RankingItem({ data }: Props) {
14+
export default function RankingItem({ data, unit }: Props) {
1415
const [currentPage, setCurrentPage] = useState<number>(1);
1516
const navigate = useNavigate();
1617
const itemsPerPage = 10;
@@ -44,7 +45,7 @@ export default function RankingItem({ data }: Props) {
4445
onClick={() => navigate(`/project/${item.projectName}`)}
4546
/>
4647
<P
47-
content={item.value.toString()}
48+
content={`${item.value.toLocaleString()} ${unit}`}
4849
cssOption='w-[140px] mr-[16px]16 text-right text-[clamp(12px,1.5vw,14px)]'
4950
/>
5051
</div>
@@ -64,7 +65,7 @@ export default function RankingItem({ data }: Props) {
6465
onClick={() => navigate(`/project/${item.projectName}`)}
6566
/>
6667
<P
67-
content={item.value.toString()}
68+
content={`${item.value.toLocaleString()} ${unit}`}
6869
cssOption='w-[140px] mr-[16px]16 text-right text-[clamp(12px,1.5vw,14px)]'
6970
/>
7071
</div>

frontend/src/component/molecule/RankingTab.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ import { RANK_OPTIONS } from '@constant/Rank';
33
import { RankType } from '@type/Rank';
44

55
type Props = {
6-
rankType: string;
6+
rankName: string;
77
setRankType: (type: RankType) => void;
88
};
99

10-
export default function RankingTab({ rankType, setRankType }: Props) {
10+
export default function RankingTab({ rankName, setRankType }: Props) {
1111
return (
1212
<div className='border-gray-200 flex justify-between border-b'>
1313
<div>
1414
{RANK_OPTIONS.map((option) => (
1515
<button
16-
key={option.value}
17-
className={`px-4 py-2 ${option.value === rankType ? 'border-blue-500 text-blue-500 border-b-2' : 'text-gray hover:text-black dark:hover:text-white'}`}
16+
key={option.value.name}
17+
className={`px-4 py-2 ${option.value.name === rankName ? 'border-blue-500 text-blue-500 border-b-2' : 'text-gray hover:text-black dark:hover:text-white'}`}
1818
onClick={() => setRankType(option.value)}>
1919
{option.label}
2020
</button>

frontend/src/component/molecule/RegisterText.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ export default function RegisterText() {
99
<div className='flex flex-col gap-[10px] text-[18px]'>
1010
<H1 cssOption='font-medium text-[50px] border-[2px]' content='등록 절차' />
1111
<P content='1. 프로젝트명, 도메인, 아이피 주소를 입력합니다.' />
12-
<P content='2. 등록 완료 후 표시된 네임 서버를 복사합니다.' />
12+
<P content='2. 등록 완료 후 전송된 네임 서버를 복사합니다.' />
1313
<P content='3. 상용 DNS (ex. Cloudflare, Gabia)의 가이드에 따라 네임 서버와 IP를 등록해 주세요.' />
14+
<P content='주의! 1,2차에만 작성해주시고 3차는 비워주세요' />
1415
<P cssOption='mt-[20px] font-light' content='Gabia 예시' />
1516
<Img cssOption='bg-cover' src={GabiaDescriptionImg} alt='가비아 dns 등록 설명 이미지' />
1617
<P cssOption='mt-[20px] font-light' content='CloudFlare 예시' />

frontend/src/component/organism/NavBar.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ export default function Navbar() {
1111
<aside className='border-3 flex h-screen min-h-0 flex-col rounded-[11px] bg-lightblue p-4 dark:bg-darkblue'>
1212
<div className='flex min-h-0 flex-1 flex-col'>
1313
<div className='flex min-h-0 flex-1 flex-col justify-between'>
14-
<div className='flex min-h-0 flex-col space-y-4'>
14+
<div className='flex min-h-0 flex-col gap-4 space-y-4'>
1515
<div className='flex-shrink-0 space-y-2'>
1616
<NavbarTitle />
1717
<NavbarSelectWrapper />
1818
</div>
1919
<div className='flex-shrink-0'>
2020
<NavbarMenu />
2121
</div>
22-
<div className='scrollbar-hide min-h-0 flex-1 overflow-y-scroll'>
22+
<div className='min-h-0 flex-1 overflow-y-scroll scrollbar-hide'>
2323
<CustomErrorBoundary>
2424
<NavbarRanking />
2525
</CustomErrorBoundary>

frontend/src/component/organism/RankingList.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ import { RankType } from '@type/Rank';
77
import { useState } from 'react';
88

99
export default function RankingList() {
10-
const [rankType, setRankType] = useState<RankType>('traffic');
10+
const [rankType, setRankType] = useState<RankType>({ name: 'traffic', unit: '개' });
1111
const { generation } = useNavbarStore();
12-
const { data } = useRankData(rankType, generation);
12+
const { data } = useRankData(rankType.name, generation);
1313

1414
return (
1515
<DataLayout cssOption='p-[8px] rounded-lg shadow-md w-full justify-center flex-col flex h-full'>
1616
<div className='flex h-full w-full flex-col'>
1717
<div className='mb-[16px] ml-[8px]'>
18-
<RankingTab rankType={rankType} setRankType={setRankType} />
18+
<RankingTab rankName={rankType.name} setRankType={setRankType} />
1919
</div>
2020
<div className='flex h-full justify-center'>
21-
<RankingItem data={data} />
21+
<RankingItem data={data} unit={rankType.unit} />
2222
</div>
2323
</div>
2424
</DataLayout>

frontend/src/constant/Rank.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { RankType } from '@type/Rank';
22

33
const RANK_OPTIONS: { value: RankType; label: string }[] = [
4-
{ value: 'traffic', label: '트래픽양' },
5-
{ value: 'success-rate', label: '요청 성공률' },
6-
{ value: 'elapsed-time', label: '평균 응답시간' },
7-
{ value: 'dau', label: 'DAU' }
4+
{ value: { name: 'traffic', unit: '개' }, label: '트래픽양' },
5+
{ value: { name: 'success-rate', unit: '%' }, label: '요청 성공률' },
6+
{ value: { name: 'elapsed-time', unit: 'ms' }, label: '평균 응답시간' },
7+
{ value: { name: 'dau', unit: '명' }, label: 'DAU' }
88
];
99

1010
export { RANK_OPTIONS };

frontend/src/type/Rank.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
type RankType = 'traffic' | 'success-rate' | 'elapsed-time' | 'dau';
1+
type RankType =
2+
| { name: 'traffic'; unit: '개' }
3+
| { name: 'success-rate'; unit: '%' }
4+
| { name: 'elapsed-time'; unit: 'ms' }
5+
| { name: 'dau'; unit: '명' };
26

37
export type { RankType };

0 commit comments

Comments
 (0)