Skip to content

Commit 155f4d8

Browse files
vcz-Chanclaude
andcommitted
๐Ÿ’„ ๋„ค๋น„๊ฒŒ์ด์…˜๋ฐ” ์Šคํฌ๋กค ์• ๋‹ˆ๋ฉ”์ด์…˜ ์ถ”๊ฐ€
- ์Šคํฌ๋กค ์‹œ ๋†’์ด ์ถ•์†Œ ๋ฐ ๊ทธ๋ฆผ์ž ๊ฐ•ํ™” - ๋กœ๊ณ  ํฌ๊ธฐ ๋ฐ˜์‘ํ˜• ์กฐ์ • - ๋ชจ๋ฐ”์ผ์—์„œ๋„ ๋กœ๊ณ  ํ‘œ์‹œ (B๋กœ ์ถ•์•ฝ) ๐Ÿค– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 615fea6 commit 155f4d8

1 file changed

Lines changed: 38 additions & 5 deletions

File tree

โ€Žsrc/components/Layout/NavBar.tsxโ€Ž

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,20 @@ export default function NavBar() {
2727
const router = useRouter()
2828
const [search, setSearch] = useState('')
2929
const [menuOpen, setMenuOpen] = useState(false)
30+
const [isScrolled, setIsScrolled] = useState(false)
3031

3132
const [profile, setProfile] = useState<UserProfile | null>(null)
3233

34+
// Scroll detection
35+
useEffect(() => {
36+
const handleScroll = () => {
37+
setIsScrolled(window.scrollY > 20)
38+
}
39+
40+
window.addEventListener('scroll', handleScroll)
41+
return () => window.removeEventListener('scroll', handleScroll)
42+
}, [])
43+
3344
useEffect(() => {
3445
if (!userId) return
3546
getUserProfile(userId)
@@ -50,11 +61,33 @@ export default function NavBar() {
5061
}
5162

5263
return (
53-
<header className="bg-gray-50 shadow-md sticky top-0 z-50">
54-
<div className="md:px-16 p-3 flex justify-between items-center">
64+
<motion.header
65+
className="bg-gray-50 sticky top-0 z-50"
66+
initial={{ height: 'auto', boxShadow: '0 1px 3px 0 rgb(0 0 0 / 0.1)' }}
67+
animate={{
68+
height: isScrolled ? 56 : 'auto',
69+
boxShadow: isScrolled
70+
? '0 4px 6px -1px rgb(0 0 0 / 0.1)'
71+
: '0 1px 3px 0 rgb(0 0 0 / 0.1)',
72+
}}
73+
transition={{ duration: 0.2, ease: [0.4, 0, 0.2, 1] }}
74+
>
75+
<div
76+
className="md:px-16 p-3 flex justify-between items-center transition-all duration-200"
77+
style={{ padding: isScrolled ? '0.5rem 1rem' : undefined }}
78+
>
5579
{/* ๋กœ๊ณ  */}
56-
<Link href="/" className="hidden md:flex items-center mr-16">
57-
<div className="text-2xl font-bold text-gray-800 font-logo">Bubblog</div>
80+
<Link href="/" className="flex items-center mr-4 md:mr-16">
81+
<motion.div
82+
className="font-bold text-gray-800 font-logo"
83+
animate={{
84+
fontSize: isScrolled ? '1.25rem' : undefined,
85+
}}
86+
transition={{ duration: 0.2 }}
87+
>
88+
<span className="md:hidden">B</span>
89+
<span className="hidden md:inline text-xl md:text-2xl">Bubblog</span>
90+
</motion.div>
5891
</Link>
5992

6093
{/* ๊ฒ€์ƒ‰์ฐฝ */}
@@ -161,6 +194,6 @@ export default function NavBar() {
161194
)}
162195
</nav>
163196
</div>
164-
</header>
197+
</motion.header>
165198
)
166199
}

0 commit comments

Comments
ย (0)