Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/spectator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@hcc/api-base": "workspace:*",
"@hcc/icons": "workspace:*",
"@hcc/style": "workspace:*",
"@hcc/ui": "workspace:*",
"@vercel/analytics": "^1.5.0",
"next": "^15.4.6",
"react": "^19.1.1",
Expand Down
39 changes: 39 additions & 0 deletions apps/spectator/src/app/landingpage/_components/TabNavigation.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { Button } from '@hcc/ui';

interface TabNavigationProps {
activeTab: string;
onTabClick: (tabID: string) => void;
Comment on lines +4 to +5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

activeTabκ³Ό onTabClick의 tabID에 string νƒ€μž…μ„ μ‚¬μš©ν•˜λŠ” λŒ€μ‹ , 더 μ—„κ²©ν•œ μœ λ‹ˆμ˜¨ νƒ€μž… TabIdλ₯Ό μ‚¬μš©ν•˜λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€. μ΄λ ‡κ²Œ ν•˜λ©΄ νƒ€μž… μ•ˆμ •μ„±μ„ 높일 수 μžˆμŠ΅λ‹ˆλ‹€.

TabIdλŠ” μ»΄ν¬λ„ŒνŠΈ 파일 상단에 λ‹€μŒκ³Ό 같이 μ •μ˜ν•˜κ³  exportν•˜μ—¬ λΆ€λͺ¨ μ»΄ν¬λ„ŒνŠΈμ—μ„œλ„ μ‚¬μš©ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

export type TabId = 'previous' | 'recent' | 'teams';
Suggested change
activeTab: string;
onTabClick: (tabID: string) => void;
activeTab: TabId;
onTabClick: (tabID: TabId) => void;

}

export const TabNavigation = ({ activeTab, onTabClick }: TabNavigationProps) => {
const tabs = [
{ id: 'previous', label: '이전 λŒ€νšŒ' },
{ id: 'recent', label: '졜근 λŒ€νšŒ' },
{ id: 'teams', label: 'νŒ€λ³„ 보기' },
];
Comment on lines +9 to +13
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

tabs 배열은 λ Œλ”λ§λ  λ•Œλ§ˆλ‹€ μž¬μƒμ„±λ  ν•„μš”κ°€ μ—†λŠ” μƒμˆ˜ λ°μ΄ν„°μž…λ‹ˆλ‹€. μ»΄ν¬λ„ŒνŠΈ μ™ΈλΆ€λ‘œ μ΄λ™μ‹œμΌœ λΆˆν•„μš”ν•œ μž¬μƒμ„±μ„ λ°©μ§€ν•˜κ³  가독성을 λ†’μ΄λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€. μƒμˆ˜λ‘œ μ„ μ–Έν•  λ•ŒλŠ” TABS와 같이 λŒ€λ¬Έμžλ‘œ ν‘œκΈ°ν•˜λŠ” 것이 μΌλ°˜μ μž…λ‹ˆλ‹€.


return (
<div className="w-full border-gray-200 border-b bg-white pt-5">
<div className="flex justify-center">
<div role="tablist" aria-label="λŒ€νšŒ νƒ­" className="flex gap-8">
{tabs.map(tab => (
<Button
key={tab.id}
role="tab"
aria-selected={activeTab === tab.id}
className={`-mb-px relative border-b-2 px-4 pb-4 font-medium transition-all duration-150 ease-out ${
activeTab === tab.id
? 'border-neutral-900 text-neutral-900'
: 'border-transparent text-neutral-500 hover:border-neutral-300 hover:text-neutral-700'
}`}
variant="subtle"
onClick={() => onTabClick(tab.id)}
>
{tab.label}
</Button>
))}
</div>
</div>
</div>
);
};
14 changes: 14 additions & 0 deletions apps/spectator/src/app/landingpage/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use client';
import { TabNavigation } from '~/app/landingpage/_components/TabNavigation';
import { useState } from 'react';

const Page = () => {
const [activeTab, setActiveTab] = useState('recent');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

TabNavigation.tsxμ—μ„œ μ œμ•ˆν•œ λŒ€λ‘œ TabId νƒ€μž…μ„ exportν•œ ν›„, 이 νŽ˜μ΄μ§€μ—μ„œ ν•΄λ‹Ή νƒ€μž…μ„ importν•˜μ—¬ useState의 μ œλ„€λ¦­ νƒ€μž…μœΌλ‘œ μ‚¬μš©ν•˜λ©΄ νƒ€μž… μ•ˆμ •μ„±μ„ ν–₯μƒμ‹œν‚¬ 수 μžˆμŠ΅λ‹ˆλ‹€. import 문도 λ‹€μŒκ³Ό 같이 μˆ˜μ •ν•΄μ•Ό ν•©λ‹ˆλ‹€.

import { TabNavigation, type TabId } from '~/app/landingpage/_components/TabNavigation';
Suggested change
const [activeTab, setActiveTab] = useState('recent');
const [activeTab, setActiveTab] = useState<TabId>('recent');

return (
<>
<TabNavigation activeTab={activeTab} onTabClick={setActiveTab} />
{/**λ‚΄μš©* - ν΄λ¦­ν•œ tab에 λŒ€ν•œ λ‚΄μš© λžœλ”λ§*/}
</>
);
};
export default Page;
2 changes: 1 addition & 1 deletion apps/spectator/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const Page = () => {
return <div>Home</div>;
return <div />;
};

export default Page;
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.