feat: 노을 탭 시안 A — 히어로에 결론·가장 붉을 때·쉬운 이유, 내일 안내 위로, 숫자는 자세히로, 시간표에 가장 붉을 때
This commit is contained in:
1 parent
8422829f9d
commit
c30fac20a6
7 files changed
+69
-45
No files matched your search
+28
-28
@@ -33,35 +33,35 @@ const HERO = 'relative mx-3 mt-1 min-h-[230px] overflow-hidden rounded-[32px] px
|
||||
const THREE = [0, 1, 2]
|
||||
const RANK_SKELS = Array.from({ length: 8 }, (_, i) => i)
|
||||
|
||||
/** 히어로엔 해 지는(뜨는) 시각과 하늘 상황 한 줄만. 결론·이유·점수는 아래 카드로 */
|
||||
function HeroBody({ plan, sunAt }: { plan?: SkyPlanData; sunAt?: string }) {
|
||||
/** '오늘은' · '모레는' */
|
||||
const topic = (w: string) => `${w}${(w.charCodeAt(w.length - 1) - 0xac00) % 28 ? '은' : '는'}`
|
||||
|
||||
/** 히어로엔 답만: 갈 만한지, 몇 시에, 왜(쉬운 말 한 줄). 숫자는 아래 '자세히'로 */
|
||||
function HeroBody({ plan }: { plan?: SkyPlanData }) {
|
||||
const v = (node: ReactNode, w: string) => (plan ? node : <Skel className={w} />)
|
||||
return (
|
||||
<div className="relative z-[1] [text-shadow:0_2px_10px_rgb(50_25_70/0.35)]" aria-hidden={plan ? undefined : true}>
|
||||
<p className="m-0 mt-2.5 font-bagel text-[52px] leading-none">{v(sunAt && clockShort(sunAt), 'w-[150px]')}</p>
|
||||
<p className="m-0 mt-1.5 font-jua text-[21px]">{v(plan?.situation_label ?? plan?.headline, 'w-[190px]')}</p>
|
||||
<p className="m-0 mt-2.5 font-jua text-[34px] leading-tight">{v(plan && `${topic(plan.when)} ${plan.headline}`, 'w-[200px]')}</p>
|
||||
<p className="m-0 mt-1 font-jua text-[21px]">{v(plan?.best_at && `${clockShort(plan.best_at)}쯤 가장 붉어요`, 'w-[170px]')}</p>
|
||||
<p className="m-0 mt-1.5 text-[14px] font-bold opacity-95">{v(plan?.situation_label, 'w-[230px]')}</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
/** 결론과 이유, 예보 모델이 얼마나 같은 예보를 냈는지, 점수(작게) */
|
||||
function Verdict({ plan, sunAt }: { plan?: SkyPlanData; sunAt?: string }) {
|
||||
const v = (node: ReactNode, w: string) => (plan ? node : <Skel className={w} />)
|
||||
/** 점수·구름·예보 모델처럼 궁금한 사람만 볼 숫자 */
|
||||
function Details({ plan, sunAt }: { plan: SkyPlanData; sunAt?: string }) {
|
||||
// 지금 하늘이 아니라 해 질(뜰) 무렵 예보라는 걸 밝힌다
|
||||
const basis = sunAt ? `해 ${plan?.kind === 'sunrise' ? '뜰' : '질'} 무렵(${new Date(sunAt).getHours()}시) 예보 기준` : ''
|
||||
const agree = [
|
||||
basis,
|
||||
plan ? `${plan.kind === 'sunrise' ? '일출' : '노을'} 점수 ${plan.score}` : '',
|
||||
plan?.models_total ? `예보 모델 ${plan.models_total}개 중 ${plan.models_agree}개가 같은 예보` : '',
|
||||
].filter(Boolean).join(' · ')
|
||||
const basis = sunAt ? `해 ${plan.kind === 'sunrise' ? '뜰' : '질'} 무렵(${new Date(sunAt).getHours()}시) 예보 기준` : ''
|
||||
return (
|
||||
<div className="mx-3 mt-3 rounded-[22px] bg-white px-4 py-3 text-[14px] font-semibold shadow-[inset_0_-5px_0_var(--shade)]" aria-hidden={plan ? undefined : true}>
|
||||
<p className="m-0">
|
||||
<b className="mr-1.5 font-jua text-[17px] font-normal">{v(plan?.headline, 'w-20')}</b>
|
||||
{v(plan?.reason, 'w-[220px]')}
|
||||
<details className="mx-3 mt-2 rounded-[18px] bg-white/70 px-4 py-2.5 text-[13px] font-semibold text-(--ink2)">
|
||||
<summary className="cursor-pointer font-extrabold">자세히</summary>
|
||||
<p className="m-0 mt-1.5 text-(--ink)">{plan.reason}</p>
|
||||
<p className="m-0 mt-1">
|
||||
{[basis, `${plan.kind === 'sunrise' ? '일출' : '노을'} 점수 ${plan.score} (${plan.grade_label})`, plan.models_total ? `예보 모델 ${plan.models_total}개 중 ${plan.models_agree}개가 같은 예보` : '']
|
||||
.filter(Boolean)
|
||||
.join(' · ')}
|
||||
</p>
|
||||
<small className="mt-1 block text-[12px] font-bold text-(--ink2)">{v(plan && (agree || '\u00a0'), 'w-48')}</small>
|
||||
</div>
|
||||
</details>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -76,16 +76,16 @@ const TERMS = {
|
||||
},
|
||||
} as const
|
||||
|
||||
/** 노을: 골든아워 → 해 짐 → 블루아워. 일출: 블루아워 → 해 뜸 → 골든아워 */
|
||||
/** 노을: 골든아워 → 해 짐 → 가장 붉을 때 → 블루아워. 일출: 블루아워 → 가장 붉을 때 → 해 뜸 → 골든아워 */
|
||||
function Timeline({ rows, kind = 'sunset' }: { rows?: BestTime[]; kind?: SkyPlanData['kind'] }) {
|
||||
return (
|
||||
<div className="mx-3 mt-3 rounded-[22px] bg-white px-2 pt-4 pb-3 shadow-[inset_0_-5px_0_var(--shade)]" aria-hidden={rows ? undefined : true}>
|
||||
<ol className="relative grid grid-cols-3">
|
||||
<span className="absolute inset-x-[16.6%] top-[6px] h-0.5 bg-(--line)" aria-hidden="true" />
|
||||
<ol className={cx('relative grid', (rows?.length ?? 3) === 4 ? 'grid-cols-4' : 'grid-cols-3')}>
|
||||
<span className={cx('absolute top-[6px] h-0.5 bg-(--line)', (rows?.length ?? 3) === 4 ? 'inset-x-[12.5%]' : 'inset-x-[16.6%]')} aria-hidden="true" />
|
||||
{(rows ?? THREE.map(() => undefined)).map((t, i) => (
|
||||
<li key={t?.kind ?? i} className="relative flex flex-col items-center text-center">
|
||||
<span className={cx('size-3 rounded-full border-2 border-(--line) bg-white', t?.kind === 'sun' && 'border-(--orange) bg-(--orange)')} />
|
||||
<b className="mt-1.5 font-bagel text-lg leading-tight font-normal">{t ? clockShort(t.at) : <Skel className="w-12" />}</b>
|
||||
<span className={cx('size-3 rounded-full border-2 border-(--line) bg-white', t?.kind === 'peak' && 'border-(--orange) bg-(--orange)')} />
|
||||
<b className={cx('mt-1.5 font-bagel text-lg leading-tight font-normal', t?.kind === 'peak' && 'text-(--orange)')}>{t ? clockShort(t.at) : <Skel className="w-12" />}</b>
|
||||
<span className="text-[12px] font-bold text-(--ink2)">{t ? t.label : <Skel className="w-11" />}</span>
|
||||
</li>
|
||||
))}
|
||||
@@ -169,20 +169,20 @@ export function SkyPage() {
|
||||
{plan?.when ?? '오늘'} {word} · {region.name}
|
||||
</p>
|
||||
{plan || load === 'loading' ? (
|
||||
<HeroBody plan={plan} sunAt={sunAt} />
|
||||
<HeroBody plan={plan} />
|
||||
) : (
|
||||
<StateBox load={load} onRetry={() => sky.refetch()} empty="오늘 노을 정보가 없어요." hold={<HeroBody />} className="inset-x-0 top-1.5 bottom-0" />
|
||||
)}
|
||||
</div>
|
||||
{(plan || load === 'loading') && <Verdict plan={plan} sunAt={sunAt} />}
|
||||
{/* 더 나은 날이 있으면 히어로 바로 아래 */}
|
||||
{plan?.outlook && <p className="mx-3 mt-3 mb-0 rounded-[18px] bg-[#e8f6ee] px-4 py-2.5 text-[14px] font-extrabold text-[#1d6b46]">{plan.outlook}</p>}
|
||||
{plan && <Details plan={plan} sunAt={sunAt} />}
|
||||
<Sec title="언제 보면 좋을까" sub={rise ? '보통 해 뜨기 10~20분 전이 가장 붉어요' : '보통 해 진 뒤 10~20분이 가장 붉어요'} />
|
||||
{plan?.timeline?.length || load === 'loading' ? (
|
||||
<Timeline rows={plan?.timeline} kind={plan?.kind} />
|
||||
) : (
|
||||
<StateBox load="ready" empty={load === 'ready' ? '노을 시간 정보가 없어요.' : '노을 시간을 불러오지 못했어요.'} hold={<Timeline />} className="inset-x-3 top-3 bottom-0" />
|
||||
)}
|
||||
{/* 더 나은 날이 있을 때만 */}
|
||||
{plan?.outlook && <p className="mx-3 mt-3 mb-0 rounded-[22px] bg-[#ffe6ec] px-4 py-3 text-[14px] font-bold text-[#7a2a4a]">{plan.outlook}</p>}
|
||||
{!rise && <Sec title="가까운 노을 명소" sub="가까운 순 · 방향은 내 동네에서 본 쪽" />}
|
||||
{rise ? null : spots.length ? (
|
||||
<ul className="mx-3 mt-1.5 flex flex-col">
|
||||
|
||||
Reference in new issue
Block a user