feat: 오늘 히어로 D4-2 — 해 안 점수, 상태 한 줄(습도·불쾌지수·자외선·미세먼지 단계), 하루 흐름 칸이 미리보기 탭, 구름·비·눈 연출 / 각 시간대별 점수·순위 미리보기 / 자외선 시간표 단계 색 칩 / 밤 화면 어두운 아이콘 빛

This commit is contained in:
minaChoi committed 2026-10-12 15:35:34 +09:00
1 parent 4cdc8b274f
commit aa774c2a44
13 files changed
+367 -155

No files matched your search

+30
View File
@@ -595,6 +595,14 @@ export type Hero = {
* Weather Score
*/
weather_score?: number | null;
/**
* Weather Slots
*
* 오늘 구간별 날씨 점수 {morning·day·evening·night: 점수}
*/
weather_slots?: {
[key: string]: number;
};
top1?: TopIndex | null;
/**
* Bubble
@@ -618,6 +626,12 @@ export type Hero = {
* 히어로 상황 칸 1개. 지금 챙길 것(비·미세먼지·자외선·일교차·체감) 먼저
*/
stats?: Array<HeroStat>;
/**
* Status
*
* 히어로 상태 한 줄: 습도·불쾌지수·자외선(낮에만)·미세먼지 단계 이름. tone=warn 이면 조심(앱이 주황 글자로)
*/
status?: Array<HeroStat>;
};
/**
@@ -2409,6 +2423,22 @@ export type TopIndex = {
* 지금 구간이 이 각의 시간대와 겹침. false 면 순위 밖, score 는 하루 점수
*/
active?: boolean;
/**
* Slots
*
* 오늘 구간별 점수 {morning·day·evening·night: 점수}. 각 시간대와 안 겹치는 구간은 없음
*/
slots?: {
[key: string]: number;
};
/**
* Slot Ranks
*
* 오늘 구간별 순위 (점수 × 중요도 가중치). 각 시간대와 안 겹치는 구간은 없음
*/
slot_ranks?: {
[key: string]: number;
};
};
/**
+119 -83
View File
@@ -2,7 +2,7 @@ import { Fragment, useEffect, useState, type ReactNode } from 'react'
import { Link } from 'react-router'
import { useQuery } from '@tanstack/react-query'
import { getFeedOptions, getWeatherTodayOptions } from '../api/client/@tanstack/react-query.gen'
import type { BandArticle, BandEvent, Hero as HeroData, HeroStat as HeroStatData, ResWeatherToday, TopIndex } from '../api/client/types.gen'
import { RainType, Sky, type BandArticle, type BandEvent, type Hero as HeroData, type ResWeatherToday, type TopIndex, type WeatherSlot } from '../api/client/types.gen'
import { cx } from '../lib/utils'
import { cardBg, fall, kindOfHour, kst, type Load, loadOf, MEDALS, type TimeKind, WEEKDAYS } from './lib'
import { PostCard, PostCardSkel } from './Post'
@@ -10,29 +10,22 @@ import { useRegion } from './regionContext'
import { useSheet } from './sheetContext'
import { useSky } from './skyContext'
import { Ic, Rail, Sec, Skel, SkelRail, StateBox, Thumb } from './ui'
import { deg, skyText, slotAt } from './weatherText'
import { deg, slotAt } from './weatherText'
type Mode = 'now' | TimeKind
const MODES: [Mode, string][] = [
['now', '지금'],
['morning', '아침'],
['day', '낮'],
['sunset', '저녁'],
['night', '밤'],
]
// 미리보기 시간대마다 보여 줄 시계와 그 시각의 예보 칸
const PREVIEW: Record<TimeKind, { label: string; clock: string; hour: number }> = {
morning: { label: '아침', clock: '07:40', hour: 7 },
day: { label: '낮', clock: '13:20', hour: 13 },
sunset: { label: '저녁', clock: '18:25', hour: 18 },
night: { label: '밤', clock: '22:10', hour: 22 },
// 하루 흐름 칸 순서와 칸마다 볼 예보 시각
const KINDS: TimeKind[] = ['morning', 'day', 'sunset', 'night']
const PREVIEW: Record<TimeKind, { label: string; hour: number }> = {
morning: { label: '아침', hour: 7 },
day: { label: '낮', hour: 13 },
sunset: { label: '저녁', hour: 18 },
night: { label: '밤', hour: 22 },
}
// 히어로 칸을 받아 오는 동안 자리만 잡아 둔다
const STAT_HOLD = ['a']
const MUGGY = 75 // 불쾌지수 이 이상이면 경고 색
// 비·눈 줄기: 위치·주기를 엇갈려 고르게
const DROPS = Array.from({ length: 22 }, (_, i) => ({ left: `${(i * 41) % 100}%`, '--top': `${(i * 29) % 90}%`, '--dl': `${((i * 37) % 100) / 100}s`, '--dur': `${0.55 + ((i * 13) % 5) / 10}s` }))
const FLAKES = Array.from({ length: 16 }, (_, i) => ({ left: `${(i * 47) % 100}%`, '--top': `${(i * 31) % 90}%`, '--dl': `${((i * 53) % 100) / 25}s`, '--dur': `${3.2 + ((i * 7) % 5) / 2}s` }))
const STARS = Array.from({ length: 26 }, (_, i) => ({ left: `${(i * 37) % 100}%`, top: `${(i * 53) % 60}%`, opacity: 0.4 + ((i * 7) % 6) / 10 }))
// 별똥별 셋: 위치·길이·주기를 엇갈려 하나씩 떨어지게
@@ -71,33 +64,74 @@ function heroVal(load: Load, v: ReactNode, skel: string) {
const failed = (load: Load) => load === 'error' || load === 'retrying'
type HeroProps = { hero?: HeroData | null; today?: ResWeatherToday; feedLoad: Load; todayLoad: Load }
// 미리보기 탭과 서버 구간 이름. 저녁 탭(노을 하늘)은 서버의 evening 구간
const SLOT_KEY: Record<TimeKind, string> = { morning: 'morning', day: 'day', sunset: 'evening', night: 'night' }
function Hero({ hero, today, feedLoad, todayLoad }: HeroProps) {
/** 미리보기 시간대면 이미 받은 구간 점수·순위로 다시 줄 세운다. 그 구간과 안 겹치는 각은 흐리게 끝으로. 구간 값이 없으면(예전 캐시) 그대로 */
function atSlot(items: TopIndex[], kind: TimeKind | null): TopIndex[] {
const k = kind && SLOT_KEY[kind]
if (!k || !items.some((g) => Object.keys(g.slot_ranks ?? {}).length)) return items
const on = items.filter((g) => g.slot_ranks?.[k] != null && g.slots?.[k] != null)
return [
...on.map((g) => ({ ...g, score: g.slots![k], rank: g.slot_ranks![k], active: true })).sort((a, b) => a.rank - b.rank),
...items.filter((g) => !on.includes(g)).map((g) => ({ ...g, active: false })),
]
}
type HeroProps = { hero?: HeroData | null; today?: ResWeatherToday; ranked: TopIndex[]; feedLoad: Load; todayLoad: Load }
type Weather = 'clear' | 'partly' | 'cloudy' | 'rain' | 'snow' | 'sleet'
/** 예보 칸 하나의 하늘: 비·눈이 오면 그걸, 아니면 구름 양 */
function weatherOf(slot?: WeatherSlot): Weather {
const r = slot?.rain_type
if (r === RainType.RAIN || r === RainType.SHOWER) return 'rain'
if (r === RainType.SNOW) return 'snow'
if (r === RainType.SLEET) return 'sleet'
return slot?.sky === Sky.CLOUDY ? 'cloudy' : slot?.sky === Sky.PARTLY ? 'partly' : 'clear'
}
const WEATHER_ICON: Record<Weather, string> = { clear: 'sun', partly: 'sun_cloud', cloudy: 'cloud', rain: 'rain', snow: 'snow', sleet: 'snow' }
// 구름 수: 구름 많음 둘, 흐림·비·눈 셋
const CLOUDS = [
{ cls: 'top-9 left-[5%] h-8 w-[84px]', d: '.1s', f: '6s' },
{ cls: 'top-[96px] left-[63%] h-9 w-[96px]', d: '.25s', f: '6.4s' },
{ cls: 'top-[30px] left-[72%] h-7 w-[64px]', d: '.4s', f: '5.4s' },
]
const CLOUD_N: Record<Weather, number> = { clear: 0, partly: 2, cloudy: 3, rain: 3, snow: 3, sleet: 3 }
function Hero({ hero, today, ranked, feedLoad, todayLoad }: HeroProps) {
const { open } = useSheet()
const { preview, setServerKind, setPreview } = useSky()
const mode: Mode = preview ?? 'now'
const setMode = (m: Mode) => setPreview(m === 'now' ? null : m)
const clock = useNow()
const t = kst(clock)
const kind = mode === 'now' ? (hero?.sky_mode ?? kindOfHour(t.h, t.mo, t.mi)) : mode
const nowKind = hero?.sky_mode ?? kindOfHour(t.h, t.mo, t.mi)
const kind = mode === 'now' ? nowKind : mode
// 화면 전체 하늘 배경도 같은 시간대로 맞춘다
useEffect(() => setServerKind(hero?.sky_mode ?? null), [hero?.sky_mode, setServerKind])
const slots = today?.slots ?? []
const slot = slots.length ? slotAt(slots, mode === 'now' ? t.h : PREVIEW[mode].hour) : undefined
// 지금은 /v1/feed hero 값을, 미리보기는 그 시각의 예보 칸을 쓴다
const temp = mode === 'now' && hero ? hero.temp_c : slot?.temp_c
const top1 = hero?.top1
const who = kind === 'night' ? 'bear' : 'rabbit'
// 그 시각 칸, 비어 있으면(지난 새벽 칸 등) 그 뒤 첫 예보 칸
const slotOf = (k: TimeKind | 'now') => {
const h = k === 'now' ? t.h : PREVIEW[k].hour
const s = slots.length ? slotAt(slots, h) : undefined
return s?.temp_c != null ? s : (slots.find((x) => kst(x.at).h > h && x.temp_c != null) ?? s)
}
const weather = weatherOf(slotOf(mode))
const slotScore = mode === 'now' ? undefined : hero?.weather_slots?.[SLOT_KEY[mode]]
const score = slotScore ?? hero?.weather_score
const slotTop = mode === 'now' ? undefined : ranked.find((g) => g.active)
const top1 = slotTop ?? hero?.top1
// 저녁(노을)부터는 가운데 동그라미가 오늘 밤 달 모양이 된다
const moon = (kind === 'sunset' || kind === 'night') && hero?.moon_name && hero.moon_pct != null ? { name: hero.moon_name, pct: hero.moon_pct, waning: WANING.includes(hero.moon_name) } : null
const tempLoad = mode === 'now' ? feedLoad : todayLoad
const tempChip = temp != null ? `${deg(temp)}${slot ? ` ${skyText(slot)}` : ''}` : null
const bubble = hero ? (hero.bubble ?? '오늘은 쉬어 가요') : failed(feedLoad) ? '앗, 날씨를 못 불러왔어요' : null
const bubble = slotTop ? (slotTop.score >= 70 ? `오늘은 ${slotTop.name}!` : '오늘은 쉬어 가요') : hero ? (hero.bubble ?? '오늘은 쉬어 가요') : failed(feedLoad) ? '앗, 날씨를 못 불러왔어요' : null
const status = hero?.status ?? []
const rain = weather === 'rain' || weather === 'sleet'
const snow = weather === 'snow' || weather === 'sleet'
// 시안 A: 점수 해가 주인공. 위에 시간대 탭과 날짜, 가운데 큰 해, 아래 칩 한 줄과 캐릭터 말풍선(1위 각)
// 시안 D4-2: 가운데 해(점수)와 하늘 날씨, 결론 두 줄, 상태 한 줄, 아래 하루 흐름 칸(누르면 그 시간대 하늘로)
return (
<div className="b-hero relative mx-3 mt-1 overflow-hidden rounded-[28px] px-4 pt-3 pb-3" data-t={kind}>
<div className="b-hero relative mx-3 mt-1 overflow-hidden rounded-[28px] px-4 pt-3 pb-3" data-t={kind} data-sky={weather}>
<div className="b-stars pointer-events-none absolute inset-0" aria-hidden="true">
{STARS.map((s, i) => (
<i key={i} className="absolute size-[3px] rounded-full shadow-[0_0_6px_#fff]" style={s} />
@@ -106,19 +140,20 @@ function Hero({ hero, today, feedLoad, todayLoad }: HeroProps) {
<span key={i} className="b-shoot" style={s} />
))}
</div>
<div className="relative z-[3] grid grid-cols-5 rounded-full bg-white/45 p-1" role="tablist" aria-label="시간대 배경 미리보기">
{MODES.map(([m, l]) => (
<button key={m} type="button" role="tab" aria-selected={mode === m} onClick={() => setMode(m)} className={cx('cursor-pointer rounded-full py-[5px] text-[13px] font-bold', mode === m ? 'bg-white text-(--ink) shadow-[0_2px_6px_rgb(40_48_74/0.12)]' : 'text-(--ink) opacity-70')}>
{l}
</button>
))}
</div>
<p className="relative z-[3] mt-2 mb-0 text-[14px] font-bold opacity-90">
{t.mo}월 {t.d}일 {WEEKDAYS[t.wd]} · <b className="font-bagel text-[19px] font-normal">{mode === 'now' ? `${String(t.h).padStart(2, '0')}:${String(t.mi).padStart(2, '0')}` : PREVIEW[mode].clock}</b>
{(rain || snow) && (
<div className="pointer-events-none absolute inset-0 z-[2]" aria-hidden="true">
{rain && DROPS.map((s, i) => <i key={i} className="b-drop" style={s} />)}
{snow && FLAKES.map((s, i) => <i key={i} className="b-flake" style={s} />)}
</div>
)}
<p className="relative z-[3] m-0 text-[14px] font-bold opacity-80">
{t.mo}월 {t.d}일 {WEEKDAYS[t.wd]}요일
</p>
<div className="relative h-[196px]">
<span className="b-cloud b-fall top-3 left-[4%] h-8 w-[84px]" style={fall('.1s', '6s')} aria-hidden="true" />
<div className="b-sun b-fall absolute top-2 left-1/2 -ml-[90px] grid aspect-square w-[180px] place-items-center rounded-full text-center" style={fall('0s', '5.6s', '8px')}>
<div className="relative h-[146px]">
{CLOUDS.slice(0, CLOUD_N[weather]).map((c) => (
<span key={c.cls} className={cx('b-cloud b-fall z-[1]', c.cls)} style={fall(c.d, c.f)} aria-hidden="true" />
))}
<div className="b-sun b-fall absolute top-2 left-1/2 -ml-16 grid aspect-square w-32 place-items-center rounded-full text-center" style={fall('0s', '5.6s', '8px')}>
{/* 안 보이는 쪽을 덮어 오늘 밤 달 모양으로 */}
{moon && (
<svg viewBox="-1 -1 2 2" className="pointer-events-none absolute inset-0 size-full" aria-hidden="true">
@@ -126,53 +161,52 @@ function Hero({ hero, today, feedLoad, todayLoad }: HeroProps) {
</svg>
)}
<span className={cx('relative', moon && '[text-shadow:0_0_6px_#fff,0_0_12px_#fff]')}>
<small className="block font-jua text-[13px]">{failed(feedLoad) ? '점수를 못 불러왔어요' : '지금 날씨 점수'}</small>
<b className="block font-bagel text-[74px] leading-[0.95] font-normal">{heroVal(feedLoad, hero?.weather_score, 'w-[120px]')}</b>
<small className="block font-jua text-[12px]">{failed(feedLoad) ? '점수를 못 불러왔어요' : `${slotScore != null && mode !== 'now' ? PREVIEW[mode].label : '지금'} 날씨 점수`}</small>
<b className="block font-bagel text-[52px] leading-[0.95] font-normal">{heroVal(feedLoad, score, 'w-[84px]')}</b>
</span>
</div>
<span className="b-cloud b-fall top-[140px] left-[58%] h-9 w-[96px]" style={fall('.25s', '6.4s')} aria-hidden="true" />
</div>
{/* 기온·습도·불쾌지수 + 서버가 고른 챙길 것(비·미세먼지·자외선·일교차 등) 한 칸을 한 줄 네 칸으로. 휴대폰에서 두 줄로 넘치지 않게 칸 안에서 위아래로 */}
<div className="relative z-[3] mt-1 grid auto-cols-fr grid-flow-col gap-1.5">
<Stat label={mode === 'now' ? '지금' : PREVIEW[mode].label}>{heroVal(tempLoad, tempChip, 'w-12')}</Stat>
<Stat label="습도">{heroVal(feedLoad, hero?.humidity != null ? `${hero.humidity}%` : null, 'w-10')}</Stat>
<Stat label="불쾌지수" tone={hero?.discomfort != null && hero.discomfort >= MUGGY ? 'warn' : 'normal'}>
{heroVal(feedLoad, hero?.discomfort != null ? `${hero.discomfort} ${hero.discomfort_label ?? ''}`.trim() : null, 'w-10')}
</Stat>
{hero?.stats?.length
? hero.stats.map((s) => (
<Stat key={s.label} label={s.label} tone={s.tone}>
{s.value}
</Stat>
))
: feedLoad === 'loading' && STAT_HOLD.map((k) => <Stat key={k} label="">{heroVal(feedLoad, null, 'w-12')}</Stat>)}
</div>
<div className="relative z-[3] mt-2 flex items-center gap-2">
<Ic name={who} alt={who === 'rabbit' ? '토끼' : '곰'} className="w-[44px] shrink-0 drop-shadow-[0_8px_10px_rgb(40_48_74/0.15)]" />
<div className="relative z-[3] text-center">
{top1 ? (
<button type="button" onClick={() => open({ type: 'gak', indexId: top1.index_id })} aria-label={`${bubble ?? ''} 1위 ${top1.name} ${top1.score}점, 계산 근거 보기`} className="b-bubble flex min-w-0 flex-1 cursor-pointer items-center gap-2 rounded-[18px] px-3 py-2 text-left">
<span className="min-w-0 flex-1 truncate font-jua text-[16px]">{bubble}</span>
<Ic name={top1.icon} className="w-7 shrink-0" />
<em className="font-bagel text-[17px] text-(--orange) not-italic">{top1.score}</em>
<button type="button" onClick={() => open({ type: 'gak', indexId: top1.index_id })} aria-label={`${bubble ?? ''} 1위 ${top1.name} ${top1.score}점, 계산 근거 보기`} className="cursor-pointer font-jua text-[24px] leading-tight">
{bubble}
</button>
) : (
<span className="b-bubble min-w-0 flex-1 rounded-[18px] px-3 py-2 font-jua text-[16px]">{bubble ?? <Skel className="w-[120px]" />}</span>
<p className="m-0 font-jua text-[24px] leading-tight">{bubble ?? <Skel className="w-[160px]" />}</p>
)}
<p className="m-0 mt-0.5 text-[15px] font-bold opacity-80">{top1?.summary ?? (feedLoad === 'loading' ? <Skel className="w-[140px]" /> : null)}</p>
{/* 상태 한 줄: 습도·불쾌지수·자외선·미세먼지 단계 이름. 조심할 것만 색 */}
{status.length > 0 && (
<p className="m-0 mt-1.5 flex flex-wrap justify-center gap-x-1.5 font-jua text-[14px]">
{status.map((x, i) => (
<Fragment key={x.label}>
{i > 0 && <span className="opacity-30" aria-hidden="true">·</span>}
<span className={cx('whitespace-nowrap', x.tone === 'warn' && 'b-warn')}>
<span className={cx(x.tone !== 'warn' && 'opacity-75')}>{x.label}</span> <b className="font-normal">{x.value}</b>
</span>
</Fragment>
))}
</p>
)}
</div>
<div className="b-strip relative z-[3] mt-2.5 grid grid-cols-4 gap-1 rounded-[18px] p-[3px]" role="tablist" aria-label="하루 흐름, 누르면 그 시간대 하늘로">
{KINDS.map((k) => {
const s = slotOf(k)
const on = k === kind
const isNow = k === nowKind
return (
<button key={k} type="button" role="tab" aria-selected={on} onClick={() => setPreview(isNow ? null : k)} className={cx('flex cursor-pointer flex-col items-center rounded-[14px] py-1.5', on && 'b-strip-on')}>
<span className={cx('text-[13px] font-bold', on ? 'text-(--orange-deep)' : 'opacity-75')}>{isNow ? '지금' : PREVIEW[k].label}</span>
<Ic name={k === 'night' && weatherOf(s) === 'clear' ? 'moon' : WEATHER_ICON[weatherOf(s)]} className="my-0.5 h-[22px] w-[22px] object-contain" />
<b className="font-jua text-[15px] font-normal">{heroVal(todayLoad, s?.temp_c != null ? deg(s.temp_c) : null, 'w-7')}</b>
</button>
)
})}
</div>
</div>
)
}
/** 히어로 아래 한 칸: 작은 이름 위, 값 아래. tone 은 서버가 정한 상태(비·경고)로 색을 바꾼다 */
function Stat({ label, tone = 'normal', children }: { label: string; tone?: HeroStatData['tone']; children: ReactNode }) {
return (
<span className="b-stat flex min-w-0 flex-col items-center rounded-2xl px-1.5 pt-1.5 pb-2 text-center break-keep" data-tone={tone}>
<small className="text-[11.5px] font-bold opacity-75">{label}</small>
<b className="font-jua text-[14.5px] leading-tight font-normal">{children}</b>
</span>
)
}
const WANING = ['기우는 달', '하현달', '그믐달']
/**
@@ -309,9 +343,11 @@ export function TodayPage() {
const { region } = useRegion()
const feed = useQuery(getFeedOptions({ query: { region: region.code } }))
const today = useQuery(getWeatherTodayOptions({ query: { region: region.code } }))
const { preview } = useSky()
const f = feed.data
const posts = f?.posts ?? []
const stories = f?.stories ?? []
const stories = atSlot(f?.stories ?? [], preview)
const sloted = preview != null && stories !== f?.stories
const bands = f?.bands
const nowAt = f?.hero?.now_at
const load = loadOf(feed)
@@ -323,14 +359,14 @@ export function TodayPage() {
// 디자인대로 3·6·9번째 글 뒤에 띠를 넣고, 글이 모자라면 남은 띠는 맨 뒤에 붙인다
const bandAt: [number, ReactNode][] = [
[3, bands?.events?.length ? <EventsBand key="events" events={bands.events} /> : null],
[6, bands?.top5?.length ? <TopBand key="top5" items={bands.top5} sub={nowAt ? `${kst(nowAt).h}시 기준` : '오늘 기준'} /> : null],
[6, bands?.top5?.length ? <TopBand key="top5" items={sloted ? stories.filter((g) => g.active) : bands.top5} sub={sloted ? `${PREVIEW[preview].label} 기준` : nowAt ? `${kst(nowAt).h}시 기준` : '오늘 기준'} /> : null],
[9, bands?.season?.length ? <SeasonBand key="season" news={bands.season} /> : null],
]
return (
// 피드 칸은 전국 공통이라 지역이 바뀌어도 글 번호가 같다. 지역마다 새로 그려 넘긴 슬라이드·펼친 상태가 남지 않게 한다
<section key={region.code} aria-label="오늘" aria-busy={load === 'loading'} className={cx('transition-opacity', feed.isPlaceholderData && 'opacity-60')}>
<Hero hero={f?.hero} today={today.data} feedLoad={load} todayLoad={loadOf(today)} />
<Hero hero={f?.hero} today={today.data} ranked={stories} feedLoad={load} todayLoad={loadOf(today)} />
<Sec title="오늘의 각" sub="누르면 계산 근거를 보여 줘요" more={{ to: '/gak' }} />
{/* 실패 안내는 여기 한 번만, 각 줄 스켈레톤과 같은 크기로 */}
{stories.length ? <Stories items={stories} /> : load === 'loading' ? <StoriesSkel /> : <StateBox load={load} onRetry={() => feed.refetch()} empty="오늘 계산된 각이 없어요." hold={<StoriesSkel />} className="inset-x-3 top-3 bottom-1" />}
+67 -30
View File
@@ -170,39 +170,72 @@
.b-stars i {
background: #fff;
}
.b-stat {
background: rgb(255 255 255 / 0.72);
color: var(--ink);
box-shadow: inset 0 -5px 0 rgb(217 229 244 / 0.9);
/* 히어로 하루 흐름 칸: 한 판 위에 고른 칸만 흰 바탕 */
.b-strip {
background: rgb(255 255 255 / 0.42);
}
.b-hero[data-t='night'] .b-stat,
.b-hero[data-t='sunset'] .b-stat {
background: rgb(255 255 255 / 0.18);
color: #fff;
box-shadow: inset 0 -5px 0 rgb(255 255 255 / 0.12);
.b-hero[data-t='sunset'] .b-strip,
.b-hero[data-t='night'] .b-strip {
background: rgb(255 255 255 / 0.14);
}
.b-hero[data-t='sunset'] .b-stat {
background: rgb(30 16 80 / 0.2);
}
/* 히어로 칸 강조: 조심(노랑)·비(파랑). 시간대 배경과 상관없이 같은 색 */
.b-hero .b-stat[data-tone='warn'] {
background: #fff3d6;
color: var(--ink);
box-shadow: inset 0 -5px 0 #ffd98a;
}
.b-hero .b-stat[data-tone='rain'] {
background: #dcecff;
color: var(--ink);
box-shadow: inset 0 -5px 0 #a9cdf5;
}
.b-bubble {
.b-strip-on {
background: #fff;
color: var(--ink);
box-shadow: 0 8px 16px rgb(40 48 74 / 0.1);
color: #28304a; /* 밤엔 --ink 가 밝은 색이라 고정 */
box-shadow: 0 4px 12px rgb(40 48 74 / 0.1);
}
.b-hero[data-t='night'] .b-bubble {
background: rgb(30 34 70 / 0.85);
color: #fff;
/* 상태 한 줄에서 조심할 것. 밤·노을 배경에선 밝은 주황 */
.b-warn {
color: var(--orange-deep);
}
.b-hero[data-t='sunset'] .b-warn,
.b-hero[data-t='night'] .b-warn {
color: #ffb38a;
}
/* 흐리거나 비·눈 오는 아침·낮은 하늘을 잿빛으로 */
.b-hero[data-t='morning']:is([data-sky='cloudy'], [data-sky='rain'], [data-sky='snow'], [data-sky='sleet']),
.b-hero[data-t='day']:is([data-sky='cloudy'], [data-sky='rain'], [data-sky='snow'], [data-sky='sleet']) {
background: linear-gradient(180deg, #a9bbd0, #cbd7e4 55%, #eef2f7);
}
.b-hero:is([data-sky='cloudy'], [data-sky='rain'], [data-sky='snow'], [data-sky='sleet']) .b-sun {
filter: saturate(0.7) brightness(0.96);
}
.b-drop,
.b-flake {
position: absolute;
top: -24px;
animation: b-fallsky var(--dur) linear var(--dl) infinite;
}
.b-drop {
width: 2px;
height: 18px;
border-radius: 2px;
background: linear-gradient(transparent, rgb(80 130 200 / 0.7));
}
.b-hero[data-t='sunset'] .b-drop,
.b-hero[data-t='night'] .b-drop {
background: linear-gradient(transparent, rgb(220 230 255 / 0.7));
}
.b-flake {
width: 7px;
height: 7px;
border-radius: 50%;
background: #fff;
box-shadow: 0 0 4px rgb(120 150 200 / 0.5);
}
@keyframes b-fallsky {
to {
transform: translate(var(--drift, -8px), 440px);
}
}
.b-flake {
--drift: 18px;
}
@media (prefers-reduced-motion: reduce) {
.b-drop,
.b-flake {
animation: none;
top: var(--top);
}
}
.b-orb-label {
text-shadow: 0 2px 0 rgb(255 255 255 / 0.7);
@@ -536,7 +569,7 @@
.b-app[data-t='night'] [class*='bg-white/'] {
background-color: rgb(34 42 92 / 0.85);
}
.b-app[data-t='night'] :is([class*='bg-[#f'], [class*='bg-[#e'], [class*='bg-[#d'], [class*='bg-[#c'], [class*='bg-[linear-gradient']) {
.b-app[data-t='night'] :is([class*='bg-[#f'], [class*='bg-[#e'], [class*='bg-[#d'], [class*='bg-[#c'], [class*='bg-[linear-gradient']):not(.b-keep-bg) {
background: var(--chip);
}
.b-app[data-t='night'] [class*='border-[#dfe5ee]'] {
@@ -595,6 +628,10 @@
background: linear-gradient(180deg, rgb(110 230 180 / 0.12), rgb(255 255 255 / 0));
}
.b-app[data-t='night'] img[data-dark] {
filter: drop-shadow(0 0 1px rgb(255 255 255 / 0.9)) drop-shadow(0 0 6px rgb(255 255 255 / 0.3));
}
/* 밤엔 메인 탭 동그라미 테두리를 막대 색에 맞춘다 */
.b-app[data-t='night'] .b-tab-main > span {
--tw-ring-color: rgb(18 24 60 / 0.9);
+14 -4
View File
@@ -6,10 +6,13 @@ import { AVATAR_COLORS, iconSrc, moodEmoji, naverMap, type Load } from './lib'
type IcProps = { name: string; className?: string; alt?: string; style?: CSSProperties }
// 거의 검은 아이콘. 밤 화면에선 테두리 빛을 둘러 보이게 한다
const DARK_ICONS = new Set(['walk', 'dog'])
export function Ic({ name, className, alt = '', style }: IcProps) {
const src = iconSrc(name)
if (!src) return <span aria-hidden className={cx('block', className)} style={style} />
return <img src={src} alt={alt} className={cx('block', className)} style={style} decoding="async" />
return <img src={src} alt={alt} className={cx('block', className)} style={style} decoding="async" data-dark={DARK_ICONS.has(name) || undefined} />
}
/** 사진 출처 표기 (공공누리 조건). 사진 위에서도 읽히게 반투명 배경. 위치는 className 으로 */
@@ -206,13 +209,20 @@ export function MapLink({ place, children, className }: { place: string; childre
)
}
export function Rows({ rows, dark = false }: { rows: { label: string; value: string; place?: string | null }[]; dark?: boolean }) {
/** 자외선 단계(1 낮음 ~ 5 위험) 칩 색 */
const LEVEL_CHIP = ['bg-[#1f9d62] text-white', 'bg-[#ffc21a] text-[#3a2a00]', 'bg-[#f0700a] text-white', 'bg-[#e03131] text-white', 'bg-[#8e3bc4] text-white']
export function Rows({ rows, dark = false }: { rows: { label: string; value: string; place?: string | null; level?: number | null }[]; dark?: boolean }) {
return (
<div className="mt-auto flex flex-col">
{rows.map((r) => (
<div key={r.label} className={cx('flex justify-between gap-2.5 border-b-2 py-2.5 font-bold last:border-b-0', dark ? 'border-white/18' : 'border-[rgb(40_48_74/0.08)]')}>
<div key={r.label} className={cx('flex items-center justify-between gap-2.5 border-b-2 py-2.5 font-bold last:border-b-0', dark ? 'border-white/18' : 'border-[rgb(40_48_74/0.08)]')}>
<span>{r.label}</span>
<b className="text-right font-jua text-[17px] font-normal">{r.place ? <MapLink place={r.place}>{r.value}</MapLink> : r.value}</b>
{r.level ? (
<b className={cx('rounded-full px-2.5 py-[3px] font-jua text-[15px] font-normal', LEVEL_CHIP[r.level - 1])}>{r.value}</b>
) : (
<b className="text-right font-jua text-[17px] font-normal">{r.place ? <MapLink place={r.place}>{r.value}</MapLink> : r.value}</b>
)}
</div>
))}
</div>