-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
78 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,22 @@ | ||
import { useEffect, useState } from 'react'; | ||
import { Link, useRouterState } from '@tanstack/react-router'; | ||
import { Harmony } from '@/components/logo'; | ||
import { Button } from '@/components/ui/button'; | ||
import { cn } from '@/lib/utils'; | ||
|
||
interface HeaderProps { | ||
className?: string; | ||
} | ||
|
||
function Header({ className }: HeaderProps) { | ||
const router = useRouterState(); | ||
const { pathname } = router.location; | ||
const [isTop, setIsTop] = useState(true); | ||
|
||
useEffect(() => { | ||
const handleScroll = () => { | ||
const currentScrollY = window.scrollY; | ||
setIsTop(currentScrollY <= 10); | ||
}; | ||
|
||
handleScroll(); | ||
window.addEventListener('scroll', handleScroll, { passive: true }); | ||
|
||
return () => window.removeEventListener('scroll', handleScroll); | ||
}, []); | ||
|
||
const isLoginPage = pathname === '/login'; | ||
const isSignupPage = pathname === '/signup'; | ||
|
||
const headerClasses = cn( | ||
'fixed top-0 w-full h-16', | ||
'flex items-center justify-between', | ||
'px-6 bg-white dark:bg-black', | ||
'text-black dark:text-white', | ||
'transition-all duration-200', | ||
{ | ||
'border-b border-gray-200 dark:border-gray-800 shadow-sm': !isTop, | ||
}, | ||
className | ||
); | ||
import { ReactNode } from 'react'; | ||
|
||
function Header({ children }: { children: ReactNode }) { | ||
return ( | ||
<header className={headerClasses}> | ||
{/* Logo Section */} | ||
<div className="flex items-center space-x-4"> | ||
<Link to="/" className="transition-opacity hover:opacity-80"> | ||
<Harmony size={32} /> | ||
</Link> | ||
</div> | ||
|
||
{/* Navigation Buttons */} | ||
<nav className="flex items-center space-x-3"> | ||
{!isLoginPage && ( | ||
<Button variant={isSignupPage ? 'outline' : 'ghost'} asChild> | ||
<Link to="/login" className="hover:text-primary font-medium transition-colors"> | ||
로그인 | ||
</Link> | ||
</Button> | ||
)} | ||
|
||
{!isSignupPage && ( | ||
<Button variant="outline" asChild> | ||
<Link to="/signup" className="hover:text-primary font-medium transition-colors"> | ||
회원가입 | ||
</Link> | ||
</Button> | ||
)} | ||
</nav> | ||
<header className="px-6"> | ||
<nav className="flex h-16 items-center justify-between">{children}</nav> | ||
</header> | ||
); | ||
} | ||
|
||
function Left({ children }: { children: ReactNode }) { | ||
return <div className="flex items-center gap-4">{children}</div>; | ||
} | ||
|
||
function Right({ children }: { children: ReactNode }) { | ||
return <div className="flex items-center gap-2">{children}</div>; | ||
} | ||
|
||
Header.Left = Left; | ||
Header.Right = Right; | ||
|
||
export default Header; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters