Skip to content

Commit 7353a18

Browse files
committed
refactor(header): 헤더 레이아웃 정리 및 인증 슬롯 처리 개선
- 대형 화면에서 grid 기반 레이아웃을 사용하도록 헤더 구조 수정 - 반응형 정렬 및 간격을 조정해 전체 헤더 정렬 개선 - HeaderAuthSlot에서 로딩/비인증 상태 분기 로직 정리 - 로그아웃 시 유저 관련 query cache를 확실히 제거하도록 처리 - auction 섹션 설명 문구 소폭 수정
1 parent d74d44d commit 7353a18

File tree

4 files changed

+21
-16
lines changed

4 files changed

+21
-16
lines changed

src/screens/main/model/sections.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const SECTIONS = [
1111
{
1212
key: "processList",
1313
title: "⚡ 경매 진행 중",
14-
description: "실시간 경매가 진행 중인 상품을 모아봤어요!",
14+
description: "실시간 경매가 진행 중이에요!",
1515
variant: "live",
1616
moreHref: `${ROUTES.auctions}?status=PROCESS`,
1717
},

src/widgets/header/header.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,19 @@ import HeaderSearch from "@/widgets/header/ui/header-search";
1111
export function Header() {
1212
return (
1313
<header className="bg-background h-header sticky top-0 z-50 hidden select-none md:flex">
14-
<Container className="lg:px flex items-center justify-around gap-4 px-2 min-[960px]:px-3 lg:px-5 xl:px-7">
14+
<Container className="lg:px flex h-full items-center gap-4 px-2 py-0 min-[960px]:px-3 lg:px-5 xl:grid xl:grid-cols-[minmax(0,1fr)_minmax(0,540px)_minmax(0,1fr)] xl:gap-4 xl:px-7">
1515
<Link href="/" className="shrink-0">
1616
<h1 className="flex items-center gap-1">
1717
<Image src={Logo} alt="윈드폴 로고" sizes="40px" />
1818
<span className="hidden text-xl font-semibold min-[960px]:block">Windfall</span>
1919
</h1>
2020
</Link>
2121

22-
<Suspense fallback={<div className="flex-1" aria-hidden />}>
23-
<HeaderSearch />
24-
</Suspense>
22+
<div className="flex-1 xl:w-full">
23+
<Suspense fallback={<div className="h-10 w-full" aria-hidden />}>
24+
<HeaderSearch />
25+
</Suspense>
26+
</div>
2527

2628
<HeaderAuthSlot />
2729
</Container>

src/widgets/header/ui/header-auth-slot.tsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,10 @@ import HeaderActions from "@/widgets/header/ui/header-actions";
1212
export default function HeaderAuthSlot() {
1313
const { data, isPending } = useUserBasic();
1414

15-
if (isPending) {
16-
return <div className="h-10 w-24" aria-hidden />;
17-
}
15+
let content = <div className="h-10 w-24" aria-hidden />;
1816

19-
if (!data) {
20-
return (
17+
if (!isPending && !data) {
18+
content = (
2119
<Button asChild size="lg">
2220
<Link href={ROUTES.login} aria-label="로그인">
2321
<LogIn className="size-5" />
@@ -27,10 +25,14 @@ export default function HeaderAuthSlot() {
2725
);
2826
}
2927

30-
return (
31-
<HeaderActions
32-
avatarUrl={data.userProfileUrl || undefined}
33-
avatarAlt={data.username || "프로필"}
34-
/>
35-
);
28+
if (data) {
29+
content = (
30+
<HeaderActions
31+
avatarUrl={data.userProfileUrl || undefined}
32+
avatarAlt={data.username || "프로필"}
33+
/>
34+
);
35+
}
36+
37+
return <div className="flex h-full items-center justify-end">{content}</div>;
3638
}

src/widgets/header/ui/header-user-menu.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export default function HeaderUserMenu({ avatarUrl, avatarAlt }: HeaderUserMenuP
4343
} catch {
4444
showToast.error("로그아웃에 실패했습니다. 잠시 후 다시 시도해주세요.");
4545
} finally {
46+
queryClient.setQueryData(userKeys.basic(), null);
4647
queryClient.removeQueries({ queryKey: userKeys.all, exact: false });
4748
router.refresh();
4849
router.push(ROUTES.login);

0 commit comments

Comments
 (0)