Skip to content

Commit 09c8e1b

Browse files
committed
design: 포스트 페이지 바텀탭 디자인 변경
1 parent 9d65f38 commit 09c8e1b

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

src/components/mobile-bottom-tab.tsx

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
Home,
88
Moon,
99
Sun,
10+
Undo2,
1011
UserRoundSearch,
1112
} from "lucide-react";
1213
import { AnimatePresence, motion, useMotionValue, useSpring, useTransform } from "motion/react";
@@ -204,19 +205,19 @@ export function MobileBottomTab() {
204205
const clampedIndex = Math.max(0, Math.min(tabs.length - 1, nearestIndex));
205206
indicatorX.set(clampedIndex * TAB_STEP);
206207

207-
if (clampedIndex !== activeIndex) {
208+
if (tabs[clampedIndex].href !== pathname) {
208209
navigateTo(tabs[clampedIndex].href);
209210
}
210211
} else if (touchedTabIndex.current !== null) {
211-
// Tap on a tab — navigate
212+
// Tap on a tab — navigate (even if same tab, pathname might differ)
212213
const i = touchedTabIndex.current;
213-
if (i !== activeIndex) {
214+
if (tabs[i].href !== pathname) {
214215
navigateTo(tabs[i].href);
215216
}
216217
}
217218

218219
touchedTabIndex.current = null;
219-
}, [activeIndex, indicatorX, indicatorScale]);
220+
}, [pathname, indicatorX, indicatorScale]);
220221

221222
return (
222223
<AnimatePresence>
@@ -295,7 +296,8 @@ export function MobileBottomTab() {
295296
{/* Tab items — plain divs, no Link */}
296297
<div className="relative z-10 flex" style={{ gap: TAB_GAP }}>
297298
{tabs.map((tab, i) => {
298-
const Icon = tab.icon;
299+
const isPostPage = pathname.startsWith("/post");
300+
const Icon = (isPostPage && tab.href === "/") ? Undo2 : tab.icon;
299301
const isActive = i === activeIndex;
300302
return (
301303
<div
@@ -305,7 +307,17 @@ export function MobileBottomTab() {
305307
style={{ width: TAB_WIDTH, height: 48, WebkitTouchCallout: "none" }}
306308
>
307309
<motion.div style={{ scale: tabScales[i], opacity: tabOpacities[i] }}>
308-
<Icon className="size-[22px]" strokeWidth={isActive ? 2.2 : 1.8} />
310+
<AnimatePresence mode="wait" initial={false}>
311+
<motion.div
312+
key={Icon.displayName || Icon.name}
313+
initial={{ scale: 0.7, opacity: 0, rotate: -20 }}
314+
animate={{ scale: 1, opacity: 1, rotate: 0 }}
315+
exit={{ scale: 0.7, opacity: 0, rotate: 20 }}
316+
transition={{ duration: 0.2, ease: "easeInOut" }}
317+
>
318+
<Icon className="size-[22px]" strokeWidth={isActive ? 2.2 : 1.8} />
319+
</motion.div>
320+
</AnimatePresence>
309321
</motion.div>
310322
</div>
311323
);

0 commit comments

Comments
 (0)