fix: 앱 오늘 날씨 포스트 시간 칸을 웹처럼 4칸씩 두 줄로
This commit is contained in:
1 parent
d1143e4207
commit
1bc39655c9
2 files changed
+24
-13
No files matched your search
@@ -23,6 +23,8 @@ const GAK_BG: SlideBg[] = ['butter', 'peach', 'lilac'];
|
||||
const ROW_ICON_BG: Record<string, SlideBg> = { umbrella: 'lilac', vent: 'mint', sunset: 'peach', thermo: 'sky', maple: 'peach', moon: 'lilac', glasses: 'butter' };
|
||||
const DARK = new Set<SlideBg>(['dusk', 'night']);
|
||||
|
||||
const chunk = <T,>(items: T[], n: number) => Array.from({ length: Math.ceil(items.length / n) }, (_, i) => items.slice(i * n, i * n + n));
|
||||
|
||||
// 노을 하늘 상황(1 가려짐 2 낮은 구름 3 물들 구름 적음 4 넓게 물듦 5 두꺼움)별 하늘, 시간 칸 색 (웹 .b-sit-*, .b-cut-*)
|
||||
const SIT_BG: Record<number, { colors: Stops; locations: readonly [number, number, ...number[]] }> = {
|
||||
1: { colors: ['#6f7690', '#9aa0b4', '#b9b4c0'], locations: [0, 0.55, 1] },
|
||||
@@ -98,18 +100,27 @@ export function SlideView({ slide, bg }: { slide: Slide; bg: SlideBg }) {
|
||||
<Base colors={palette.sky}>
|
||||
<Eyebrow>{slide.eyebrow}</Eyebrow>
|
||||
<Big>{slide.line}</Big>
|
||||
<View className="mt-3.5 flex-1 flex-row gap-2">
|
||||
{slide.hours.map((h) => {
|
||||
const tone = HOUR_TONE[h.tone ?? ''];
|
||||
return (
|
||||
<View key={h.label} className={`flex-1 items-center justify-between overflow-hidden rounded-[18px] px-1 pt-2.5 pb-[9px] ${tone ? '' : 'border-b-[5px] border-shade bg-card'}`} style={tone ? { backgroundColor: tone.bg, borderBottomWidth: 5, borderColor: tone.edge } : undefined}>
|
||||
{h.temp_c != null && <LinearGradient colors={['rgba(255,122,69,0.1)', 'rgba(255,122,69,0.34)']} style={{ position: 'absolute', left: 0, right: 0, bottom: 0, height: `${20 + ((h.temp_c - lo) / span) * 70}%` }} />}
|
||||
<Text className={`text-xs font-bold ${tone ? 'text-[#5a6380]' : 'text-ink2'}`}>{h.label}</Text>
|
||||
<Ic name={h.icon} size={34} />
|
||||
<Text className={`font-bagel text-[21px] ${tone ? 'text-[#28304a]' : 'text-ink'}`}>{deg(h.temp_c)}</Text>
|
||||
</View>
|
||||
);
|
||||
})}
|
||||
{/* 웹 grid-cols-4: 4칸씩 줄을 나눈다 */}
|
||||
<View className="mt-3.5 flex-1 gap-2">
|
||||
{chunk(slide.hours, 4).map((row) => (
|
||||
<View key={row[0].label} className="flex-1 flex-row gap-2">
|
||||
{row.map((h) => {
|
||||
const tone = HOUR_TONE[h.tone ?? ''];
|
||||
return (
|
||||
<View key={h.label} className={`flex-1 items-center justify-between overflow-hidden rounded-[18px] px-1 pt-2.5 pb-[9px] ${tone ? '' : 'border-b-[5px] border-shade bg-card'}`} style={tone ? { backgroundColor: tone.bg, borderBottomWidth: 5, borderColor: tone.edge } : undefined}>
|
||||
{h.temp_c != null && <LinearGradient colors={['rgba(255,122,69,0.1)', 'rgba(255,122,69,0.34)']} style={{ position: 'absolute', left: 0, right: 0, bottom: 0, height: `${20 + ((h.temp_c - lo) / span) * 70}%` }} />}
|
||||
<Text className={`text-xs font-bold ${tone ? 'text-[#5a6380]' : 'text-ink2'}`}>{h.label}</Text>
|
||||
<Ic name={h.icon} size={34} />
|
||||
<Text className={`font-bagel text-[21px] ${tone ? 'text-[#28304a]' : 'text-ink'}`}>{deg(h.temp_c)}</Text>
|
||||
</View>
|
||||
);
|
||||
})}
|
||||
{/* 마지막 줄이 모자라면 빈 칸으로 너비를 맞춘다 */}
|
||||
{Array.from({ length: 4 - row.length }, (_, i) => (
|
||||
<View key={`pad${i}`} className="flex-1" />
|
||||
))}
|
||||
</View>
|
||||
))}
|
||||
</View>
|
||||
</Base>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user