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
8 changes: 4 additions & 4 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ function App() {
<Route element={<Layout showBottomNav />}>
<Route path="home" element={<Home />} />
<Route path="notifications" element={<NotificationsPage />} />
<Route path="council">
<Route index element={<CouncilDetail />} />
<Route path="notice/:noticeId" element={<CouncilNotice />} />
</Route>
<Route path="mypage">
<Route index element={<MyPage />} />
<Route path="manager">
Expand Down Expand Up @@ -116,10 +120,6 @@ function App() {
<Route path="mypage/manager/:clubId/recruitment/write" element={<ManagedRecruitmentWrite />} />
<Route path="mypage/manager/:clubId/recruitment/account" element={<ManagedAccount />} />
<Route path="profile" element={<Profile />} />
<Route path="council">
<Route index element={<CouncilDetail />} />
<Route path="notice/:noticeId" element={<CouncilNotice />} />
</Route>
<Route path="chats/:chatRoomId" element={<ChatRoom />} />
</Route>
</Route>
Expand Down
2 changes: 1 addition & 1 deletion src/assets/svg/clock.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/assets/svg/instagram.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/assets/svg/location-pin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/components/layout/BottomNav/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const BOTTOM_NAV_ITEMS = [
to: '/home',
label: '홈',
floatingImageSrc: HomeResultImage,
matchesPath: (pathname) => pathname === '/home' || pathname === '/notifications',
matchesPath: (pathname) => pathname === '/home' || pathname === '/notifications' || pathname.startsWith('/council'),
},
{ to: '/chats', label: '채팅방', Icon: ChatIcon },
{ to: '/mypage', label: '내정보', Icon: MyPageIcon },
Expand Down
24 changes: 24 additions & 0 deletions src/components/layout/BottomOverlaySpacer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type { HTMLAttributes } from 'react';
import {
DEFAULT_BOTTOM_OVERLAY_GAP,
type BottomOverlayGap,
useBottomOverlayOffset,
} from '@/components/layout/bottomOverlay';
import { cn } from '@/utils/ts/cn';

interface BottomOverlaySpacerProps extends HTMLAttributes<HTMLDivElement> {
gap?: BottomOverlayGap;
}

function BottomOverlaySpacer({
gap = DEFAULT_BOTTOM_OVERLAY_GAP,
className,
style,
...props
}: BottomOverlaySpacerProps) {
const height = useBottomOverlayOffset(gap);

return <div aria-hidden="true" className={cn('shrink-0', className)} style={{ height, ...style }} {...props} />;
}

export default BottomOverlaySpacer;
50 changes: 50 additions & 0 deletions src/components/layout/Header/components/BackTitleHeader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import type { CSSProperties, ReactNode } from 'react';
import ChevronLeftIcon from '@/assets/svg/chevron-left.svg';
import { useSmartBack } from '@/utils/hooks/useSmartBack';
import { cn } from '@/utils/ts/cn';

interface BackTitleHeaderProps {
title: string;
onBack?: () => void;
rightSlot?: ReactNode;
reserveRightSlot?: boolean;
headerClassName?: string;
leftContentClassName?: string;
rightSlotContainerClassName?: string;
titleClassName?: string;
style?: CSSProperties;
}

function BackTitleHeader({
title,
onBack,
rightSlot,
reserveRightSlot = false,
headerClassName,
leftContentClassName,
rightSlotContainerClassName,
titleClassName,
style,
}: BackTitleHeaderProps) {
const smartBack = useSmartBack();
const handleBack = onBack ?? smartBack;

return (
<header className={cn('fixed top-0 right-0 left-0 z-30 flex items-center bg-white', headerClassName)} style={style}>
<div className={cn('flex min-w-0 flex-1 items-center gap-1', leftContentClassName)}>
<button type="button" aria-label="뒤로가기" onClick={handleBack} className="shrink-0">
<ChevronLeftIcon />
</button>
<h1 className={cn('text-text-700 min-w-0 truncate leading-7 font-semibold', titleClassName)}>{title}</h1>
</div>

{rightSlot ? (
<div className={cn('shrink-0', rightSlotContainerClassName)}>{rightSlot}</div>
) : reserveRightSlot ? (
<div className={cn('size-6 shrink-0', rightSlotContainerClassName)} aria-hidden="true" />
) : null}
</header>
);
}

export default BackTitleHeader;
27 changes: 0 additions & 27 deletions src/components/layout/Header/components/CouncilHeader.tsx

This file was deleted.

11 changes: 11 additions & 0 deletions src/components/layout/Header/components/PlainSubpageHeader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import BackTitleHeader from '@/components/layout/Header/components/BackTitleHeader';

interface PlainSubpageHeaderProps {
title: string;
}

function PlainSubpageHeader({ title }: PlainSubpageHeaderProps) {
return <BackTitleHeader title={title} headerClassName="px-4 py-2" />;
}

export default PlainSubpageHeader;
26 changes: 8 additions & 18 deletions src/components/layout/Header/components/SubpageHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { CSSProperties, ReactNode } from 'react';
import ChevronLeftIcon from '@/assets/svg/chevron-left.svg';
import { useSmartBack } from '@/utils/hooks/useSmartBack';
import BackTitleHeader from '@/components/layout/Header/components/BackTitleHeader';
import { cn } from '@/utils/ts/cn';

interface SubpageHeaderProps {
Expand All @@ -14,28 +13,19 @@ function SubpageHeader({
rightSlot,
shadowClassName = 'shadow-[0_0_20px_rgba(0,0,0,0.03)]',
}: SubpageHeaderProps) {
const smartBack = useSmartBack();
const headerStyle = {
minHeight: 'var(--subpage-header-height)',
} as CSSProperties;

return (
<header
className={cn(
'fixed top-0 right-0 left-0 z-30 flex items-center justify-between rounded-b-3xl bg-white px-4 py-3',
shadowClassName
)}
<BackTitleHeader
title={title}
rightSlot={rightSlot}
reserveRightSlot
headerClassName={cn('justify-between rounded-b-3xl px-4 py-3', shadowClassName)}
titleClassName="text-sub1 text-indigo-700"
style={headerStyle}
>
<div className="flex min-w-0 flex-1 items-center gap-1">
<button type="button" aria-label="뒤로가기" onClick={smartBack} className="shrink-0">
<ChevronLeftIcon />
</button>
<h1 className="text-sub1 truncate text-indigo-700">{title}</h1>
</div>

{rightSlot ? <div className="shrink-0">{rightSlot}</div> : <div className="size-6 shrink-0" aria-hidden="true" />}
</header>
/>
);
}

Expand Down
10 changes: 5 additions & 5 deletions src/components/layout/Header/headerConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ export const HEADER_CONFIGS: HeaderConfig[] = [
type: 'notification',
match: (pathname) => pathname === '/notifications',
},
{
type: 'subpage',
match: (pathname) => /^\/council\/notice\/\d+$/.test(pathname),
},
{
type: 'default',
match: (pathname) => /^\/clubs\/\d+$/.test(pathname),
Expand All @@ -19,16 +23,12 @@ export const HEADER_CONFIGS: HeaderConfig[] = [
},
{
type: 'info',
match: (pathname) => pathname === '/home' || pathname === '/timer',
match: (pathname) => pathname === '/home' || pathname === '/timer' || pathname === '/council',
},
{
type: 'chat',
match: (pathname) => /^\/chats\/\d+$/.test(pathname),
},
{
type: 'council',
match: (pathname) => pathname === '/council',
},
{
type: 'normal',
match: (pathname) => pathname === '/signup/finish' || /^\/clubs\/\d+\/complete$/.test(pathname),
Expand Down
3 changes: 2 additions & 1 deletion src/components/layout/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import ChatHeader from './components/ChatHeader';
import DefaultHeader from './components/DefaultHeader';
import InfoHeader from './components/InfoHeader';
import ManagerHeader from './components/ManagerHeader';
import PlainSubpageHeader from './components/PlainSubpageHeader';
import ProfileHeader from './components/ProfileHeader';
import ScheduleHeader from './components/ScheduleHeader';
import SubpageHeader from './components/SubpageHeader';
Expand All @@ -20,11 +21,11 @@ function Header() {
chat: () => <ChatHeader />,
none: () => null,
notification: ({ title }) => <SubpageHeader title={title} />,
subpage: ({ title }) => <PlainSubpageHeader title={title} />,
schedule: () => <ScheduleHeader />,
normal: ({ title }) => <DefaultHeader title={title} showBackButton={false} />,
full: ({ title }) => <DefaultHeader title={title} showNotificationBell={true} />,
signup: ({ title, onBack }) => <DefaultHeader title={title} onBack={onBack} />,
council: ({ title }) => <DefaultHeader title={title} />,
default: ({ title }) => <DefaultHeader title={title} />,
manager: ({ title }) => <ManagerHeader fallbackTitle={title} />,
};
Expand Down
4 changes: 4 additions & 0 deletions src/components/layout/Header/routeTitles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ export const ROUTE_TITLES: RouteTitle[] = [
match: (pathname) => pathname === '/council',
title: '총동아리연합회',
},
{
match: (pathname) => /^\/council\/notice\/\d+$/.test(pathname),
title: '공지사항',
},
{
match: (pathname) => pathname === '/notifications',
title: '알림',
Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/Header/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ export type HeaderType =
| 'chat'
| 'none'
| 'notification'
| 'subpage'
| 'default'
| 'normal'
| 'full'
| 'signup'
| 'schedule'
| 'council'
| 'manager';

export interface HeaderConfig {
Expand Down
Loading
Loading