feat: 시안 B 화면을 기본 화면으로, Hey API로 백엔드 연결
- 예전 화면(/, /a)과 목업 데이터를 지우고 시안 B 를 / 로 - @hey-api/openapi-ts 로 타입·TanStack Query 함수 생성, 토큰·401 갱신 처리 - 공유는 기본 공유창, 없으면 링크 복사 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e134295ce5
commit
f8b47f064a
147 files changed
+12350
No files matched your search
@@ -0,0 +1,80 @@
|
||||
import { useEffect } from 'react'
|
||||
import { NavLink, Outlet, useLocation } from 'react-router'
|
||||
import { cx } from '../lib/utils'
|
||||
import './b.css'
|
||||
import { AuthProvider } from './auth'
|
||||
import { RegionProvider } from './region'
|
||||
import { useRegion } from './regionContext'
|
||||
import { useSheet } from './sheetContext'
|
||||
import { SheetProvider } from './Sheets'
|
||||
import { PinIcon, TabIcon } from './svg'
|
||||
|
||||
const TABS = [
|
||||
{ to: '/', key: 'today', label: '오늘', title: null },
|
||||
{ to: '/gak', key: 'gak', label: '각', title: '오늘의 각' },
|
||||
{ to: '/sky', key: 'sky', label: '노을', title: '노을' },
|
||||
{ to: '/week', key: 'week', label: '주말·행사', title: '주말·행사' },
|
||||
{ to: '/season', key: 'season', label: '계절·상식', title: '계절·상식' },
|
||||
] as const
|
||||
|
||||
function TopBar() {
|
||||
const { pathname } = useLocation()
|
||||
const { region } = useRegion()
|
||||
const { open } = useSheet()
|
||||
const tab = TABS.find((t) => t.to !== '/' && pathname.startsWith(t.to))
|
||||
|
||||
return (
|
||||
<header className="sticky top-0 z-20 flex h-[54px] items-center justify-between gap-2.5 bg-[rgb(247_251_255/0.9)] px-4 backdrop-blur-md">
|
||||
{tab?.title ? <h1 className="font-jua text-[22px] font-normal">{tab.title}</h1> : <h1 className="font-jua text-[25px] font-normal text-(--orange)">날씨각</h1>}
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => open({ type: 'region' })}
|
||||
aria-label={`위치 바꾸기, 지금 ${region.name}`}
|
||||
className="flex cursor-pointer items-center gap-1 rounded-full bg-white px-3 py-1.5 text-[13.5px] font-bold shadow-[inset_0_-4px_0_var(--shade),0_6px_12px_rgb(40_48_74/0.07)]"
|
||||
>
|
||||
<PinIcon className="size-3.5" />
|
||||
{region.name}
|
||||
</button>
|
||||
</header>
|
||||
)
|
||||
}
|
||||
|
||||
function Shell() {
|
||||
const { pathname } = useLocation()
|
||||
useEffect(() => {
|
||||
window.scrollTo({ top: 0 })
|
||||
}, [pathname])
|
||||
|
||||
return (
|
||||
<div className="min-h-dvh bg-(--outer) text-(--ink)">
|
||||
<div className="relative mx-auto min-h-dvh max-w-[440px] overflow-x-clip bg-(--page) pb-[calc(70px+env(safe-area-inset-bottom,0px))]">
|
||||
<TopBar />
|
||||
<main>
|
||||
<Outlet />
|
||||
</main>
|
||||
<nav aria-label="주요 메뉴" className="fixed bottom-0 left-1/2 z-30 grid w-full max-w-[440px] -translate-x-1/2 grid-cols-5 border-t border-(--line) bg-white/96 px-1 pt-[7px] pb-[calc(8px+env(safe-area-inset-bottom,0px))] backdrop-blur-[10px]">
|
||||
{TABS.map((t) => (
|
||||
<NavLink key={t.key} to={t.to} end={t.to === '/'} className={({ isActive }) => cx('flex flex-col items-center gap-0.5 text-[11px] font-extrabold', isActive ? 'text-(--ink) [&_svg]:stroke-[2.4]' : 'text-(--ink3) [&_svg]:stroke-[1.9]')}>
|
||||
<TabIcon name={t.key} className="size-[25px]" />
|
||||
{t.label}
|
||||
</NavLink>
|
||||
))}
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export function BLayout() {
|
||||
return (
|
||||
<div className="b-app">
|
||||
<AuthProvider>
|
||||
<RegionProvider>
|
||||
<SheetProvider>
|
||||
<Shell />
|
||||
</SheetProvider>
|
||||
</RegionProvider>
|
||||
</AuthProvider>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user