feat: 단풍 지도 디자인 검수 반영 — 카드 2장(지도·순위), 라벨 눌러 고르기, 엑스 없앤 선택 줄, 명소마다 공유 이미지, 시·도 이름, 밤 화면 글자, 확대할수록 이름
This commit is contained in:
1 parent
d75144a6ac
commit
1888dd6cf3
7 files changed
+448
-146
No files matched your search
+144
-95
@@ -1,8 +1,9 @@
|
||||
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'
|
||||
import { useNavigate, useSearchParams } from 'react-router'
|
||||
import { SITE_URL } from '../api/setup'
|
||||
import { cx } from '../lib/utils'
|
||||
import { ICON_R, KIND, LABEL, LABEL_INK, LEAF_SHADOW, MAP_IMG, MAP_SRC, STAGE, headline, md, placeLabels, spread, useFoliage, useLabelSize, type Box, type Kind, type Pt, type Spot, type Stage } from './foliage'
|
||||
import { ICON_R, LABEL, LABEL_INK, LEAF_SHADOW, MAP_IMG, MAP_SRC, PROVINCE, PROVINCES, labelBoxes, placeProvinces, rankNow, STAGE, headline, md, placeLabels, spread, useFoliage, useLabelSize, type Box, type Kind, type Pt, type Spot, type Stage } from './foliage'
|
||||
import { useSheet } from './sheetContext'
|
||||
import { FoliageMapShare, FoliageSpotShare } from './shareCards'
|
||||
import { SendIcon } from './svg'
|
||||
import { Chips, Ic, TAP44 } from './ui'
|
||||
|
||||
@@ -11,12 +12,16 @@ type Filter = 'all' | Kind
|
||||
|
||||
const DOT_R: Record<Stage, number> = { peak: ICON_R, first: 4, before: 3, gone: 3 }
|
||||
const MAX_ZOOM = 5
|
||||
// 고른 명소는 흰 동그라미로 크게
|
||||
const SEL_R = 18
|
||||
const FIT_TOP = 30
|
||||
const FIT_BOTTOM = 14
|
||||
// 이름 우선순위(절정 단풍 > 절정 은행 > 첫 단풍 > 나머지)와 그 이름이 나오기 시작하는 배율(처음 화면 대비)
|
||||
const pri = (m: Spot) => (m.stage === 'peak' ? (m.kind === 'maple' ? 0 : 1) : m.stage === 'first' ? 2 : 3)
|
||||
const LABEL_FROM = [1, 1.6, 1.6, 2.5]
|
||||
const LABEL_FROM = [1, 1.6, 2.5, 3.5]
|
||||
// 점이 나오기 시작하는 배율: 처음엔 절정 잎만 보여 차분하게
|
||||
const DOT_FROM: Record<Stage, number> = { peak: 1, first: 1.6, before: 2.5, gone: 2.5 }
|
||||
const TAP_R = 24
|
||||
const SHARE_ICON = 'relative grid size-9 shrink-0 cursor-pointer place-items-center rounded-full [&_svg]:size-[19px] [&_svg]:fill-none [&_svg]:stroke-(--ink2) [&_svg]:stroke-[1.9]'
|
||||
const SHARE_BTN = `${SHARE_ICON} bg-white/80`
|
||||
const GROUPS: [Stage, string][] = [
|
||||
['peak', '지금 절정'],
|
||||
['first', '곧 절정'],
|
||||
@@ -28,18 +33,23 @@ const FILTERS: [Filter, string][] = [
|
||||
['maple', '단풍'],
|
||||
['ginkgo', '은행'],
|
||||
]
|
||||
// 단계마다 잎 아이콘을 얼마나 흐리게: 절정만 또렷하게
|
||||
const LEAF_DIM: Record<Stage, string> = { peak: '', first: 'opacity-80', before: 'opacity-45 grayscale', gone: 'opacity-45 grayscale' }
|
||||
|
||||
// 단계 표시: 절정은 잎, 첫 단풍은 주황 점, 단풍 전·지남은 회색 점(고르면 점을 크게)
|
||||
const DOT_CLASS: Record<Stage, string> = { peak: '', first: 'bg-[#d9772e]/85', before: 'bg-[#8f8a80]/60', gone: 'bg-[#8f8a80]/60' }
|
||||
|
||||
function StageMark({ m, big }: { m: Spot; big?: boolean }) {
|
||||
if (m.stage === 'peak') return <Ic name={m.kind} className={cx('relative', big ? 'size-8' : 'size-5', LEAF_SHADOW)} />
|
||||
return <i className={cx('b-keep-bg relative rounded-full', DOT_CLASS[m.stage], big ? 'size-3.5' : m.stage === 'first' ? 'size-[7px]' : 'size-[5px]')} />
|
||||
}
|
||||
|
||||
function Marker({ p, sel }: { p: Pt; sel: boolean }) {
|
||||
const style = { left: p.x, top: p.y }
|
||||
if (p.m.stage === 'peak' || sel)
|
||||
return (
|
||||
<span className={cx('pointer-events-none absolute -translate-x-1/2 -translate-y-1/2', sel && 'z-[3] grid size-9 place-items-center rounded-full bg-white shadow-[0_2px_8px_rgb(40_48_74/0.3)] ring-2 ring-(--ink)')} style={style}>
|
||||
<Ic name={p.m.kind} className={cx(sel ? 'size-6' : 'size-5', !sel && LEAF_SHADOW, LEAF_DIM[p.m.stage])} />
|
||||
</span>
|
||||
)
|
||||
return <i className={cx('pointer-events-none absolute -translate-x-1/2 -translate-y-1/2 rounded-full', p.m.stage === 'first' ? 'size-[7px] bg-[#d9772e]/85' : 'size-[5px] bg-[#8f8a80]/60')} style={style} />
|
||||
return (
|
||||
<span className={cx('pointer-events-none absolute grid -translate-x-1/2 -translate-y-1/2 place-items-center', sel && 'z-[3]')} style={{ left: p.x, top: p.y }}>
|
||||
{/* 고른 명소는 속이 빈 고리만: 옆 명소를 가리지 않게 */}
|
||||
{sel && <i className="b-keep-bg absolute size-8 rounded-full border-[2.5px] border-[#28304a] bg-[#ffffff4d]" />}
|
||||
<StageMark m={p.m} big={sel && p.m.stage !== 'peak'} />
|
||||
</span>
|
||||
)
|
||||
}
|
||||
|
||||
/** 단풍 지도 페이지: 명소 65곳을 지도에서 확대해 보고 목록으로 고른다. 한 손가락은 확대 전엔 페이지 스크롤, 확대 뒤엔 지도 이동 */
|
||||
@@ -50,7 +60,11 @@ export function FoliagePage() {
|
||||
const [filter, setFilter] = useState<Filter>('all')
|
||||
const [sel, setSel] = useState<string | null>(params.get('spot'))
|
||||
const linked = useRef(params.get('spot'))
|
||||
const [copied, setCopied] = useState(false)
|
||||
const { open } = useSheet()
|
||||
const [shareSpot, setShareSpot] = useState<Spot | null>(null)
|
||||
const [shareReq, setShareReq] = useState(0)
|
||||
const spotShotRef = useRef<HTMLDivElement>(null)
|
||||
const mapShotRef = useRef<HTMLDivElement>(null)
|
||||
const shown = useMemo(() => spots.filter((m) => filter === 'all' || m.kind === filter), [spots, filter])
|
||||
|
||||
const vpRef = useRef<HTMLDivElement>(null)
|
||||
@@ -69,8 +83,10 @@ export function FoliagePage() {
|
||||
const xs = spots.map((m) => m.x)
|
||||
const ys = spots.map((m) => m.y)
|
||||
const [x0, x1, y0, y1] = [Math.min(...xs), Math.max(...xs), Math.min(...ys), Math.max(...ys)]
|
||||
const s = Math.min(W / ((x1 - x0 + 0.14) * W), H / ((y1 - y0 + 0.1) * W))
|
||||
return { s, tx: W / 2 - ((x0 + x1) / 2) * W * s, ty: H / 2 - ((y0 + y1) / 2) * W * s }
|
||||
// 위쪽은 맨 북쪽 이름표가 잘리지 않게 FIT_TOP 만큼 띄우고, 아래는 제주까지만
|
||||
const h = H - FIT_TOP - FIT_BOTTOM
|
||||
const s = Math.min(W / ((x1 - x0 + 0.14) * W), h / ((y1 - y0) * W))
|
||||
return { s, tx: W / 2 - ((x0 + x1) / 2) * W * s, ty: FIT_TOP + h / 2 - ((y0 + y1) / 2) * W * s }
|
||||
}, [box, spots])
|
||||
|
||||
const clamp = useCallback(
|
||||
@@ -149,7 +165,11 @@ export function FoliagePage() {
|
||||
if (m) focus(m)
|
||||
}, [box, fit, spots, set, clamp, focus])
|
||||
|
||||
const pts = useMemo(() => spread(shown.map((m) => ({ m, x: view.tx + m.x * box.W * view.s, y: view.ty + m.y * box.W * view.s, r: m.name === sel ? SEL_R : DOT_R[m.stage] }))), [shown, view, box.W, sel])
|
||||
const pts = useMemo(() => {
|
||||
const ratio = view.s / fit.s
|
||||
const visible = shown.filter((m) => m.name === sel || ratio >= DOT_FROM[m.stage] - 0.01)
|
||||
return spread(visible.map((m) => ({ m, x: view.tx + m.x * box.W * view.s, y: view.ty + m.y * box.W * view.s, r: DOT_R[m.stage] })))
|
||||
}, [shown, view, box.W, fit.s, sel])
|
||||
const ptsRef = useRef(pts)
|
||||
useLayoutEffect(() => {
|
||||
ptsRef.current = pts
|
||||
@@ -159,9 +179,12 @@ export function FoliagePage() {
|
||||
const ratio = view.s / fit.s
|
||||
const order = pts.filter((p) => p.m.name === sel || ratio >= LABEL_FROM[pri(p.m)]).sort((a, b) => Number(b.m.name === sel) - Number(a.m.name === sel) || pri(a.m) - pri(b.m))
|
||||
const blocked: Box[] = [{ l: box.W - 52, t: 0, r: box.W, b: 100 }]
|
||||
if (sel) blocked.push({ l: 0, t: box.H - 110, r: box.W, b: box.H })
|
||||
return placeLabels(order, pts, size, { l: 4, t: 4, r: box.W - 4, b: box.H - 4 }, blocked)
|
||||
return placeLabels(order, pts, size, { l: 4, t: 4, r: box.W - 4, b: box.H - 4 }, blocked, (p) => p.m.stage === 'peak' || p.m.name === sel)
|
||||
}, [pts, size, sel, view.s, fit.s, box])
|
||||
const provs = useMemo(
|
||||
() => placeProvinces(PROVINCES.map((v) => ({ name: v.name, x: view.tx + v.x * box.W * view.s, y: view.ty + v.y * box.W * view.s })), pts, labelBoxes(labelAt, size)),
|
||||
[view, box.W, pts, labelAt, size],
|
||||
)
|
||||
|
||||
const pickAt = useCallback((x: number, y: number) => {
|
||||
let best: string | null = null
|
||||
@@ -170,7 +193,7 @@ export function FoliagePage() {
|
||||
const d = Math.hypot(p.x - x, p.y - y)
|
||||
if (d < bestD) [best, bestD] = [p.m.name, d]
|
||||
}
|
||||
if (best) setSel(best)
|
||||
setSel((cur) => (best && best !== cur ? best : null))
|
||||
}, [])
|
||||
|
||||
// 손가락: 두 손가락은 확대·이동, 한 손가락은 확대했을 때만 지도 이동(아니면 페이지 스크롤), 두 번 누르면 확대
|
||||
@@ -178,7 +201,7 @@ export function FoliagePage() {
|
||||
const el = vpRef.current
|
||||
if (!el) return
|
||||
let pinch: { d: number; x: number; y: number } | null = null
|
||||
let one: { x: number; y: number; moved: boolean } | null = null
|
||||
let one: { x: number; y: number; moved: boolean; scroll: boolean } | null = null
|
||||
let lastTap = 0
|
||||
const local = (t: { clientX: number; clientY: number }) => {
|
||||
const r = el.getBoundingClientRect()
|
||||
@@ -196,7 +219,7 @@ export function FoliagePage() {
|
||||
pinch = { d: Math.hypot(a.x - b.x, a.y - b.y), x: (a.x + b.x) / 2, y: (a.y + b.y) / 2 }
|
||||
one = null
|
||||
} else if (e.touches.length === 1) {
|
||||
one = { ...local(e.touches[0]), moved: false }
|
||||
one = { ...local(e.touches[0]), moved: false, scroll: false }
|
||||
}
|
||||
}
|
||||
const onMove = (e: TouchEvent) => {
|
||||
@@ -215,12 +238,19 @@ export function FoliagePage() {
|
||||
}
|
||||
if (e.touches.length !== 1 || !one) return
|
||||
const p = local(e.touches[0])
|
||||
const first = !one.moved
|
||||
if (Math.hypot(p.x - one.x, p.y - one.y) > 6) one.moved = true
|
||||
if (!zoomed()) return
|
||||
e.preventDefault()
|
||||
if (!zoomed() || one.scroll) return
|
||||
const v = viewRef.current
|
||||
set(clamp({ s: v.s, tx: v.tx + p.x - one.x, ty: v.ty + p.y - one.y }))
|
||||
one = { ...p, moved: one.moved }
|
||||
const next = clamp({ s: v.s, tx: v.tx + p.x - one.x, ty: v.ty + p.y - one.y })
|
||||
// 첫 움직임이 세로인데 지도가 그쪽 끝에 닿아 더 못 가면 이번 손짓은 페이지 스크롤로 넘긴다
|
||||
if (first && Math.abs(p.y - one.y) > Math.abs(p.x - one.x) && next.ty === v.ty) {
|
||||
one.scroll = true
|
||||
return
|
||||
}
|
||||
e.preventDefault()
|
||||
set(next)
|
||||
one = { ...p, moved: one.moved, scroll: false }
|
||||
}
|
||||
const onEnd = (e: TouchEvent) => {
|
||||
if (e.touches.length < 2) pinch = null
|
||||
@@ -295,21 +325,20 @@ export function FoliagePage() {
|
||||
if (el) window.scrollTo({ top: window.scrollY + el.getBoundingClientRect().top - 120, behavior: 'smooth' })
|
||||
focus(m)
|
||||
}
|
||||
const share = () => {
|
||||
const url = `${SITE_URL}/foliage`
|
||||
if (navigator.share) {
|
||||
navigator.share({ title: '단풍 지도 · 날씨각', text: headline(spots), url }).catch((e: unknown) => {
|
||||
if (!(e instanceof DOMException && e.name === 'AbortError')) console.error('[foliage] share', e)
|
||||
})
|
||||
return
|
||||
}
|
||||
navigator.clipboard.writeText(url).then(
|
||||
() => setCopied(true),
|
||||
(e: unknown) => console.error('[foliage] copy', e),
|
||||
)
|
||||
// 보내기: 공유 창이 이미지(명소 하나면 그 명소 지도 조각, 아니면 전체 지도)와 링크를 같이 보낸다
|
||||
const share = (m?: Spot) => {
|
||||
setShareSpot(m ?? null)
|
||||
setShareReq((n) => n + 1)
|
||||
}
|
||||
useEffect(() => {
|
||||
if (!shareReq) return
|
||||
const el = shareSpot ? spotShotRef.current : mapShotRef.current
|
||||
if (el) open({ type: 'share', share: { title: shareSpot ? `${shareSpot.name} 단풍` : '단풍 지도', slides: [el] } })
|
||||
}, [shareReq, shareSpot, open])
|
||||
const back = () => (window.history.state?.idx > 0 ? navigate(-1) : navigate('/'))
|
||||
const peakCount = spots.filter((m) => m.stage === 'peak').length
|
||||
const peakSpots = spots.filter((m) => m.stage === 'peak')
|
||||
const peakCount = peakSpots.length
|
||||
const ranked = rankNow(spots)
|
||||
|
||||
return (
|
||||
<div className="pb-6">
|
||||
@@ -324,21 +353,33 @@ export function FoliagePage() {
|
||||
</p>
|
||||
<h2 className="m-0 mt-0.5 font-jua text-[26px] leading-tight font-normal text-balance">{headline(spots)}</h2>
|
||||
</div>
|
||||
<button type="button" onClick={share} aria-label="단풍 지도 보내기" className={cx('relative mt-0.5 grid size-9 shrink-0 cursor-pointer place-items-center rounded-full bg-white/80 shadow-[0_4px_10px_rgb(40_48_74/0.08)] [&_svg]:size-5 [&_svg]:fill-none [&_svg]:stroke-(--ink) [&_svg]:stroke-[1.9]', TAP44)}>
|
||||
<button type="button" onClick={() => share()} aria-label="단풍 지도 보내기" className={cx(SHARE_BTN, 'mt-0.5 shadow-[0_4px_10px_rgb(40_48_74/0.08)]', TAP44)}>
|
||||
<SendIcon />
|
||||
</button>
|
||||
</div>
|
||||
{copied && <p className="m-0 px-4 pt-1 text-right text-[12.5px] font-bold text-(--ink2)">링크를 복사했어요</p>}
|
||||
|
||||
<div ref={vpRef} className="relative mt-2 h-[min(122vw,calc(100dvh-250px),560px)] min-h-[320px] touch-pan-y overflow-hidden bg-[#fff6ea] select-none">
|
||||
<div ref={vpRef} className="b-keep-bg relative mt-2 h-[min(122vw,calc(100dvh-330px),560px)] min-h-[300px] touch-pan-y overflow-hidden bg-[#fff6ea] select-none">
|
||||
<img src={MAP_SRC} alt="단풍 지도" draggable={false} className={cx(MAP_IMG, 'max-w-none')} style={{ inset: 'auto', left: view.tx, top: view.ty, width: box.W * view.s, height: box.W * view.s }} />
|
||||
{provs.map((v) => (
|
||||
<span key={v.name} aria-hidden="true" className={PROVINCE} style={{ left: v.x, top: v.y }}>
|
||||
{v.name}
|
||||
</span>
|
||||
))}
|
||||
{[...pts].sort((a, b) => Number(a.m.stage === 'peak') - Number(b.m.stage === 'peak')).map((p) => (
|
||||
<Marker key={p.m.name} p={p} sel={p.m.name === sel} />
|
||||
))}
|
||||
{spots.map((m) => (
|
||||
<span key={m.name} data-label={m.name} aria-hidden="true" className={cx(LABEL, 'pointer-events-none', m.stage === 'peak' ? LABEL_INK[m.kind] : 'text-(--ink2)', !labelAt[m.name] && 'invisible')} style={labelAt[m.name] ?? { left: 0, top: 0 }}>
|
||||
<button
|
||||
key={m.name}
|
||||
type="button"
|
||||
data-label={m.name}
|
||||
aria-label={`${m.name} 고르기`}
|
||||
onClick={() => setSel(m.name === sel ? null : m.name)}
|
||||
className={cx(LABEL, 'cursor-pointer border-0', m.name === sel ? 'z-[3] bg-[#28304a] text-[#ffffff]' : m.stage === 'peak' ? LABEL_INK[m.kind] : 'bg-[#ffffffeb] text-[#5b6075]', !labelAt[m.name] && 'invisible')}
|
||||
style={labelAt[m.name] ?? { left: 0, top: 0 }}
|
||||
>
|
||||
{m.name}
|
||||
</span>
|
||||
</button>
|
||||
))}
|
||||
<div className="absolute top-2.5 right-2.5 z-[4] flex flex-col gap-2">
|
||||
{(
|
||||
@@ -347,74 +388,80 @@ export function FoliagePage() {
|
||||
['−', '축소', 1 / 1.6],
|
||||
] as const
|
||||
).map(([t, label, f]) => (
|
||||
<button key={t} type="button" aria-label={label} onClick={() => zoomAt(f, box.W / 2, box.H / 2, true)} className="grid size-9 cursor-pointer place-items-center rounded-full bg-white text-[20px] font-bold shadow-[0_2px_6px_rgb(40_48_74/0.2)]">
|
||||
<button key={t} type="button" aria-label={label} onClick={() => zoomAt(f, box.W / 2, box.H / 2, true)} className="b-keep-bg grid size-9 cursor-pointer place-items-center rounded-full bg-[#ffffff] text-[20px] font-bold text-[#28304a] shadow-[0_2px_6px_rgb(40_48_74/0.2)]">
|
||||
{t}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
{chosen && (
|
||||
<div className="absolute inset-x-2.5 bottom-2.5 z-[4] flex items-center gap-3 rounded-[18px] bg-white px-3.5 py-3 shadow-[0_6px_18px_rgb(40_48_74/0.2)]">
|
||||
<Ic name={chosen.kind} className={cx('size-9 shrink-0', LEAF_DIM[chosen.stage])} />
|
||||
<div className="min-w-0 flex-1">
|
||||
<b className="block truncate font-jua text-[19px] leading-tight font-normal">{chosen.name}</b>
|
||||
<small className="block truncate text-[12px] font-bold text-(--ink3)">
|
||||
{chosen.region} · {KIND[chosen.kind]}
|
||||
</small>
|
||||
{!chosen.own && <small className="block text-[11px] font-semibold text-(--ink3)">가까운 예측 지점 날짜예요</small>}
|
||||
</div>
|
||||
<div className="shrink-0 text-right tabular-nums">
|
||||
<b className={cx('block text-[13px] font-extrabold', chosen.stage === 'peak' ? LABEL_INK[chosen.kind] : 'text-(--ink2)')}>{STAGE[chosen.stage]}</b>
|
||||
<span className="text-[14px] font-extrabold">절정 예상 {md(chosen.peak)}</span>
|
||||
</div>
|
||||
<button type="button" onClick={() => setSel(null)} aria-label="닫기" className={cx('relative grid size-7 shrink-0 cursor-pointer place-items-center text-xl text-(--ink2)', TAP44)}>
|
||||
×
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="flex flex-wrap items-center justify-center gap-x-3 gap-y-1 px-4 pt-2.5 text-[12.5px] font-bold">
|
||||
<span className="flex items-center gap-1">
|
||||
<Ic name="maple" className={cx('size-4', LEAF_SHADOW)} />
|
||||
단풍 절정
|
||||
</span>
|
||||
<span className="flex items-center gap-1">
|
||||
<Ic name="ginkgo" className={cx('size-4', LEAF_SHADOW)} />
|
||||
은행 절정
|
||||
</span>
|
||||
<span className="flex items-center gap-1">
|
||||
<i className="size-[7px] rounded-full bg-[#d9772e]/85" />첫 단풍
|
||||
</span>
|
||||
<span className="flex items-center gap-1">
|
||||
<i className="size-[5px] rounded-full bg-[#8f8a80]/60" />단풍 전
|
||||
</span>
|
||||
</div>
|
||||
{/* 고른 명소는 범례 자리에: 지도 위를 가리지 않고, 다시 누르거나 빈 곳을 누르면 풀린다 */}
|
||||
{chosen ? (
|
||||
<div className="mx-3 mt-2 flex h-[60px] items-center gap-3 rounded-[18px] bg-white px-3.5 shadow-[inset_0_-4px_0_var(--shade)]">
|
||||
<span className="grid size-8 shrink-0 place-items-center">
|
||||
<StageMark m={chosen} big />
|
||||
</span>
|
||||
<div className="min-w-0 flex-1">
|
||||
<p className="m-0 flex items-center gap-1.5">
|
||||
<b className="truncate font-jua text-[18px] leading-tight font-normal">{chosen.name}</b>
|
||||
<span className={cx('shrink-0 rounded-full px-1.5 py-px text-[11px] font-extrabold', chosen.stage === 'peak' ? 'bg-[#ffe3db] text-[#b5321f]' : chosen.stage === 'first' ? 'bg-[#ffe8d2] text-[#a34f12]' : 'bg-(--chip) text-(--ink2)')}>{STAGE[chosen.stage]}</span>
|
||||
</p>
|
||||
<p className="m-0 flex gap-1 text-[12px] font-bold text-(--ink3)">
|
||||
<span className="truncate">{chosen.region}</span>
|
||||
<span className="shrink-0">· 절정 예상 {md(chosen.peak)}</span>
|
||||
</p>
|
||||
</div>
|
||||
<button type="button" onClick={() => share(chosen)} aria-label={`${chosen.name} 보내기`} className={cx(SHARE_BTN, TAP44)}>
|
||||
<SendIcon />
|
||||
</button>
|
||||
</div>
|
||||
) : (
|
||||
<div className="mx-3 mt-2 flex h-[60px] flex-wrap items-center justify-center gap-x-3 gap-y-1 text-[12.5px] font-bold">
|
||||
<span className="flex items-center gap-1">
|
||||
<Ic name="maple" className={cx('size-4', LEAF_SHADOW)} />
|
||||
단풍 절정
|
||||
</span>
|
||||
<span className="flex items-center gap-1">
|
||||
<Ic name="ginkgo" className={cx('size-4', LEAF_SHADOW)} />
|
||||
은행 절정
|
||||
</span>
|
||||
<span className="flex items-center gap-1">
|
||||
<i className="b-keep-bg size-[7px] rounded-full bg-[#d9772e]/85" />첫 단풍
|
||||
</span>
|
||||
<span className="flex items-center gap-1">
|
||||
<i className="b-keep-bg size-[5px] rounded-full bg-[#8f8a80]/60" />단풍 전
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<Chips label="종류" items={FILTERS} value={filter} onChange={setFilter} />
|
||||
<div className="px-3 pt-1">
|
||||
<div className="px-4">
|
||||
{GROUPS.map(([g, title]) => {
|
||||
const rows = shown.filter((m) => m.stage === g).sort((a, b) => a.peak.localeCompare(b.peak))
|
||||
if (!rows.length) return null
|
||||
return (
|
||||
<section key={g} aria-label={title}>
|
||||
<h3 className="m-0 px-1.5 pt-4 pb-1 text-[13px] font-extrabold text-(--ink3)">
|
||||
{title} {rows.length}
|
||||
<section key={g} aria-label={title} className="pt-5">
|
||||
<h3 className="m-0 flex items-baseline gap-1.5 px-1 pb-1.5 font-jua text-[19px] font-normal">
|
||||
{title}
|
||||
<span className="font-sans text-[13px] font-extrabold text-(--ink3)">{rows.length}곳</span>
|
||||
</h3>
|
||||
<ul className="m-0 list-none overflow-hidden rounded-[20px] bg-white p-0 shadow-[inset_0_-4px_0_var(--shade)]">
|
||||
<ul className="m-0 list-none border-t border-(--line) p-0">
|
||||
{rows.map((m) => (
|
||||
<li key={m.name} className="border-b border-(--line) last:border-0">
|
||||
<button type="button" onClick={() => pickFromList(m)} aria-current={m.name === sel || undefined} className={cx('flex w-full cursor-pointer items-center gap-3 px-3.5 py-2.5 text-left', m.name === sel && 'bg-[#fff1ec]')}>
|
||||
<Ic name={m.kind} className={cx('size-7 shrink-0', LEAF_DIM[m.stage])} />
|
||||
<li key={m.name} className={cx('flex items-center border-b border-(--line)', m.name === sel && 'bg-[rgb(255_122_69/0.08)]')}>
|
||||
<button type="button" onClick={() => pickFromList(m)} aria-current={m.name === sel || undefined} className="flex min-w-0 flex-1 cursor-pointer items-center gap-3 py-2.5 pl-1 text-left">
|
||||
<span className="grid size-7 shrink-0 place-items-center">
|
||||
<StageMark m={m} big />
|
||||
</span>
|
||||
<span className="min-w-0 flex-1">
|
||||
<b className="block truncate text-[15px] font-extrabold">{m.name}</b>
|
||||
<small className="block truncate text-[12px] font-semibold text-(--ink3)">
|
||||
{m.region} · {KIND[m.kind]}
|
||||
{m.region} · {m.own ? '절정 예상' : '가까운 지점 날짜'}
|
||||
</small>
|
||||
</span>
|
||||
<span className="shrink-0 text-right tabular-nums">
|
||||
<b className={cx('block text-[15px] font-extrabold', g === 'peak' && LABEL_INK[m.kind])}>{md(m.peak)}</b>
|
||||
<small className="text-[11px] font-semibold text-(--ink3)">{m.own ? '절정 예상' : '가까운 지점 날짜'}</small>
|
||||
</span>
|
||||
<b className={cx('shrink-0 font-jua text-[18px] font-normal tabular-nums', g === 'peak' ? 'text-(--orange)' : 'text-(--ink2)')}>{md(m.peak)}</b>
|
||||
</button>
|
||||
<button type="button" onClick={() => share(m)} aria-label={`${m.name} 보내기`} className={cx(SHARE_ICON, 'ml-1', TAP44)}>
|
||||
<SendIcon />
|
||||
</button>
|
||||
</li>
|
||||
))}
|
||||
@@ -422,6 +469,8 @@ export function FoliagePage() {
|
||||
</section>
|
||||
)
|
||||
})}
|
||||
<FoliageSpotShare spot={shareSpot} peak={peakSpots} ref={spotShotRef} />
|
||||
<FoliageMapShare title={headline(spots)} peak={peakSpots} ranked={ranked} ref={mapShotRef} />
|
||||
<p className="m-0 px-1.5 pt-4 text-[11.5px] leading-relaxed font-semibold text-(--ink3)">
|
||||
출처: 산림청 2026 단풍절정 예측 · 잎 절반이 물든 때를 절정으로, 그 2주 전부터 첫 단풍으로 봐요{peakCount ? ` · 지금 절정 ${peakCount}곳` : ''}
|
||||
</p>
|
||||
|
||||
Reference in new issue
Block a user