feat: 앱 나머지 화면 이전 — 게시물 카드·시트·각/노을/주말/계절 탭·움직임
- 게시물 카드 슬라이드 7종, 좋아요·댓글, 텍스트 공유 - 시트 7종(RN Modal), 위 막대 지역·계절·로그인/아바타 - 각·노을·주말·행사·계절·상식 탭, 당겨서 새로고침 - 히어로 해·구름·비·눈 움직임, 스켈레톤 깜빡임, 첫 로딩 덮개, 하늘색 전환
This commit is contained in:
1 parent
28ff032160
commit
f71dd2cebb
33 files changed
+2786
-75
No files matched your search
@@ -0,0 +1,16 @@
|
||||
// 웹 b.css 노을 탭 그라데이션. 등급별 하늘색(히어로·3일 타일)과 시간표 막대
|
||||
type Grad = { colors: readonly [string, string, ...string[]]; locations?: readonly [number, number, ...number[]] };
|
||||
|
||||
export const GRADE_SKY: Record<string, { hero: Grad; tile: Grad }> = {
|
||||
잿빛: { hero: { colors: ['#6f7690', '#9aa0b4', '#b9b4c0'], locations: [0, 0.55, 1] }, tile: { colors: ['#8f8aa5', '#b9b0bf'] } },
|
||||
은은함: { hero: { colors: ['#4b5aa8', '#7f86c6', '#e9b9a8', '#ffb27a'], locations: [0, 0.4, 0.78, 1] }, tile: { colors: ['#7f86c6', '#e9b9a8', '#f6b07a'], locations: [0, 0.7, 1] } },
|
||||
고움: { hero: { colors: ['#5b3f9e', '#c2559a', '#ff7a6a', '#ffb35c'], locations: [0, 0.45, 0.78, 1] }, tile: { colors: ['#5b3f9e', '#c2559a', '#ff7a6a'], locations: [0, 0.55, 1] } },
|
||||
붉음: { hero: { colors: ['#4a2a8a', '#b0306a', '#ff4a3a', '#ff9a3c'], locations: [0, 0.4, 0.72, 1] }, tile: { colors: ['#4a2a8a', '#b0306a', '#ff4a3a'], locations: [0, 0.5, 1] } },
|
||||
};
|
||||
|
||||
export const skyOf = (grade?: string | null) => GRADE_SKY[grade ?? ''] ?? GRADE_SKY['은은함'];
|
||||
|
||||
export const RAIL = {
|
||||
sunset: { colors: ['#f2b84b', '#f6844e', '#e8506a', '#8c5aa6', '#2d3f8f'], locations: [0, 0.45, 0.62, 0.82, 1] },
|
||||
sunrise: { colors: ['#2d3f8f', '#8c5aa6', '#e8506a', '#f6844e', '#f2b84b'], locations: [0, 0.25, 0.45, 0.6, 1] },
|
||||
} satisfies Record<string, Grad>;
|
||||
@@ -0,0 +1,189 @@
|
||||
import type { BestTime, SkyPlanData } from '@nalssigak/shared/api/client/types.gen';
|
||||
import { clockShort } from '@nalssigak/shared/lib';
|
||||
import { LinearGradient } from 'expo-linear-gradient';
|
||||
import { useState, type ReactNode } from 'react';
|
||||
import { Pressable, Text, View } from 'react-native';
|
||||
import { useCSSVariable } from 'uniwind';
|
||||
|
||||
import { RAIL, skyOf } from '@/components/sky/colors';
|
||||
import { SitSun, Skyline } from '@/components/sky/skyline';
|
||||
import { MapLink, Skel } from '@/components/ui';
|
||||
|
||||
const SHADOW = { textShadowColor: 'rgb(50 25 70 / 0.35)', textShadowOffset: { width: 0, height: 2 }, textShadowRadius: 10 };
|
||||
const FOUR = [0, 1, 2, 3];
|
||||
|
||||
/** 히어로엔 답만: 노을 피크 시각과 어떻게 물드는지. 상자는 불러오는 중·실패·빈 값 모두 같은 크기 */
|
||||
export function SkyHero({ plan, children }: { plan?: SkyPlanData; children?: ReactNode }) {
|
||||
const g = skyOf(plan?.grade_label).hero;
|
||||
return (
|
||||
<View className="mx-3 mt-1 min-h-[230px] overflow-hidden rounded-[32px] px-5 pt-5 pb-14">
|
||||
<LinearGradient colors={g.colors} locations={g.locations} style={{ position: 'absolute', inset: 0 }} />
|
||||
<SitSun />
|
||||
<Skyline />
|
||||
{children ?? (
|
||||
<View>
|
||||
{plan ? (
|
||||
<Text className="font-jua text-[28px] leading-tight text-white" style={SHADOW}>
|
||||
{plan.title}
|
||||
</Text>
|
||||
) : (
|
||||
<Skel className="h-7 w-[230px]" />
|
||||
)}
|
||||
{!plan ? (
|
||||
<Skel className="mt-2 w-[180px]" />
|
||||
) : plan.situation_label ? (
|
||||
<Text className="mt-1.5 text-[15px] font-bold text-white" style={SHADOW}>
|
||||
{plan.situation_label}
|
||||
</Text>
|
||||
) : null}
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
/** 오늘·내일·모레를 그날 예상 하늘색 타일로. 누르면 그날로 */
|
||||
export function DayTiles({ plans, day, onPick }: { plans: SkyPlanData[]; day?: string; onPick: (day: string) => void }) {
|
||||
const ink = String(useCSSVariable('--color-ink'));
|
||||
return (
|
||||
<View className="mx-3 mt-2.5 flex-row gap-2">
|
||||
{plans.map((p) => {
|
||||
const g = skyOf(p.grade_label).tile;
|
||||
const on = p.day === day;
|
||||
return (
|
||||
<Pressable key={p.day} accessibilityState={{ selected: on }} onPress={() => onPick(p.day)} className="flex-1 rounded-[18px] p-[2px]" style={{ borderWidth: 3, borderColor: on ? ink : 'transparent' }}>
|
||||
<View className="overflow-hidden rounded-2xl px-2.5 pt-2 pb-2.5">
|
||||
<LinearGradient colors={g.colors} locations={g.locations} start={{ x: 0.2, y: 0 }} end={{ x: 0.8, y: 1 }} style={{ position: 'absolute', inset: 0 }} />
|
||||
<Text className="text-[11.5px] font-extrabold text-white">{p.when}</Text>
|
||||
<Text className="font-jua text-lg leading-tight text-white">{p.best_at ? clockShort(p.best_at) : '–'}</Text>
|
||||
<Text className="text-[11.5px] font-bold text-white">
|
||||
{p.grade_label} {p.score}
|
||||
</Text>
|
||||
</View>
|
||||
</Pressable>
|
||||
);
|
||||
})}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
function Toggle({ label, children, end }: { label: ReactNode; children: ReactNode; end?: boolean }) {
|
||||
const [open, setOpen] = useState(false);
|
||||
return (
|
||||
<View>
|
||||
<Pressable onPress={() => setOpen(!open)} accessibilityState={{ expanded: open }} className={`flex-row items-center gap-1.5 ${end ? 'justify-between' : ''}`}>
|
||||
{label}
|
||||
</Pressable>
|
||||
{open && children}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
const Q = ({ className = 'bg-card/80' }: { className?: string }) => (
|
||||
<View className={`size-[18px] items-center justify-center rounded-full ${className}`}>
|
||||
<Text className="text-[11px] font-extrabold text-ink">?</Text>
|
||||
</View>
|
||||
);
|
||||
|
||||
/** 노을 점수 뜻. 지금 하늘이 아니라 해 질(뜰) 무렵 예보라는 것도 */
|
||||
export function ScoreHelp({ plan }: { plan: SkyPlanData }) {
|
||||
const sunAt = plan.timeline?.find((t) => t.kind === 'sun')?.at;
|
||||
const rise = plan.kind === 'sunrise';
|
||||
return (
|
||||
<View className="mx-3 mt-1.5 px-1">
|
||||
<Toggle
|
||||
end
|
||||
label={
|
||||
<>
|
||||
<Text className="text-[12px] font-bold text-ink2">노을 점수 100점 만점 · 높을수록 붉어요</Text>
|
||||
<Q />
|
||||
</>
|
||||
}
|
||||
>
|
||||
<Text className="mt-1.5 rounded-xl bg-card/70 px-2.5 py-2 text-[12px] leading-snug font-semibold text-ink2">
|
||||
80점 넘으면 붉게, 60점 넘으면 곱게, 40점 넘으면 은은하게 물들어요.
|
||||
{sunAt && ` 해 ${rise ? '뜰' : '질'} 무렵(${new Date(sunAt).getHours()}시) 날씨 예보로 계산했고, 노을 피크 시각은 해 ${rise ? '뜨기 10~20분 전' : '지고 10~20분 뒤'}로 어림한 거라 실제와 다를 수 있어요.`}
|
||||
</Text>
|
||||
</Toggle>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
/** 언제 보면 좋을까: 왼쪽 세로 줄 색이 그 시각 하늘색, 노을 피크만 강조 */
|
||||
export function Timeline({ rows, kind = 'sunset' }: { rows?: BestTime[]; kind?: SkyPlanData['kind'] }) {
|
||||
const rail = RAIL[kind === 'sunrise' ? 'sunrise' : 'sunset'];
|
||||
const list = rows ?? FOUR.map(() => undefined);
|
||||
return (
|
||||
<View className="mx-3 mt-3 rounded-[22px] border-b-[5px] border-shade bg-card px-4 pt-3.5 pb-3">
|
||||
<View className="flex-row gap-3">
|
||||
<LinearGradient colors={rail.colors} locations={rail.locations} style={{ width: 12, borderRadius: 6 }} />
|
||||
<View className="flex-1">
|
||||
{list.map((t, i) => {
|
||||
const peak = t?.kind === 'peak';
|
||||
return (
|
||||
<View key={t?.kind ?? i} className={`flex-row items-baseline gap-2.5 ${peak ? '-mx-1.5 my-0.5 rounded-xl bg-[#fff1f2] px-2.5 py-2' : 'py-1.5'}`} style={!peak && i < list.length - 1 ? { borderBottomWidth: 1 } : undefined}>
|
||||
<View className="min-w-[96px]">
|
||||
{t ? <Text className={`font-jua ${peak ? 'text-[20px] text-[#d23d5a]' : 'text-[17px] text-ink'}`}>{t.end ? `${clockShort(t.at)}~${clockShort(t.end)}` : clockShort(t.at)}</Text> : <Skel className="w-11" />}
|
||||
</View>
|
||||
{t ? <Text className={`flex-1 ${peak ? 'font-jua text-base text-[#d23d5a]' : 'text-[13.5px] font-bold text-ink2'}`}>{t.label}</Text> : <Skel className="w-20" />}
|
||||
</View>
|
||||
);
|
||||
})}
|
||||
</View>
|
||||
</View>
|
||||
{rows && (
|
||||
<View className="mt-2">
|
||||
<Toggle
|
||||
label={
|
||||
<>
|
||||
<Q className="bg-[#f1ebe3]" />
|
||||
<Text className="text-[12px] font-bold text-ink2">골든아워·블루아워가 뭐예요</Text>
|
||||
</>
|
||||
}
|
||||
>
|
||||
<Text className="mt-1.5 rounded-xl bg-[#faf6f1] px-2.5 py-2 text-[12px] leading-snug text-[#5a6380]">
|
||||
<Text className="font-bold text-[#28304a]">골든아워</Text> 해가 {kind === 'sunrise' ? '뜬 뒤' : '지기 전'}, 햇빛이 금빛으로 물드는 시간{'\n'}
|
||||
<Text className="font-bold text-[#28304a]">블루아워</Text> 해가 {kind === 'sunrise' ? '뜨기 전' : '진 뒤'}, 하늘이 짙은 파랑으로 남는 시간
|
||||
</Text>
|
||||
</Toggle>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
const ROW = 'flex-row items-center gap-2.5 px-1 py-3';
|
||||
|
||||
export function LiSkel({ ghost = false, last = false }: { ghost?: boolean; last?: boolean }) {
|
||||
return (
|
||||
<View className={`${ROW} border-line ${ghost ? 'opacity-0' : ''}`} style={last ? undefined : { borderBottomWidth: 1.5 }}>
|
||||
<View className="w-[34px] items-center">
|
||||
<Skel className="w-5" />
|
||||
</View>
|
||||
<View className="flex-1 gap-1.5">
|
||||
<Skel className="h-4 w-24" />
|
||||
<Skel className="w-40" />
|
||||
</View>
|
||||
<Skel className="w-9" />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
/** 번호 · 이름(+설명) · 오른쪽 값 한 줄 */
|
||||
export function Li({ no, title, sub, right, mine = false, place, last = false }: { no: number; title: string; sub?: string | null; right: string; mine?: boolean; place?: string; last?: boolean }) {
|
||||
return (
|
||||
<View className={`${ROW} border-line ${mine ? 'rounded-2xl bg-card' : ''}`} style={last ? undefined : { borderBottomWidth: 1.5 }}>
|
||||
<Text className="w-[34px] text-center font-bagel text-xl text-orange">{no}</Text>
|
||||
<View className="min-w-0 flex-1">
|
||||
<Text className="font-jua text-[17px] text-ink">
|
||||
{place ? <MapLink place={place}>{title}</MapLink> : title}
|
||||
{mine && <Text className="text-xs font-extrabold text-rain"> 내 지역</Text>}
|
||||
</Text>
|
||||
<Text numberOfLines={1} className="text-[12.5px] font-semibold text-ink2">
|
||||
{sub || ' '}
|
||||
</Text>
|
||||
</View>
|
||||
<Text className="font-jua text-base text-ink">{right}</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import { View } from 'react-native';
|
||||
import Svg, { Defs, Polygon, RadialGradient, Rect, Stop } from 'react-native-svg';
|
||||
|
||||
// 웹 .b-skyline::after 의 clip-path 를 그대로 (0~100 비율)
|
||||
const POINTS = '0,55 8,55 8,30 15,30 15,50 22,50 22,10 28,10 28,45 36,45 36,25 44,25 44,55 52,55 52,35 60,35 60,5 66,5 66,40 74,40 74,20 82,20 82,50 90,50 90,30 100,30 100,100 0,100';
|
||||
|
||||
/** 아래에 깔리는 동네 건물 실루엣. height 는 상자 높이 대비 비율 */
|
||||
export function Skyline({ height = '22%' }: { height?: `${number}%` }) {
|
||||
return (
|
||||
<View pointerEvents="none" style={{ position: 'absolute', left: 0, right: 0, bottom: 0, height }}>
|
||||
<Svg width="100%" height="100%" viewBox="0 0 100 100" preserveAspectRatio="none">
|
||||
<Polygon points={POINTS} fill="#2d2440" />
|
||||
</Svg>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
/** 건물 뒤로 지는 해 (.b-sit-sun) */
|
||||
export function SitSun({ size = 112, bottom = 24, opacity = 1 }: { size?: number; bottom?: number; opacity?: number }) {
|
||||
return (
|
||||
<View pointerEvents="none" style={{ position: 'absolute', bottom, left: '50%', marginLeft: -size / 2, width: size, height: size, opacity }}>
|
||||
<Svg width={size} height={size} viewBox="0 0 2 2">
|
||||
<Defs>
|
||||
<RadialGradient id="sitsun" cx="1" cy="1" r="1" gradientUnits="userSpaceOnUse">
|
||||
<Stop offset="0" stopColor="#fff6dd" />
|
||||
<Stop offset="0.38" stopColor="#ffd08f" />
|
||||
<Stop offset="0.7" stopColor="#ffa05a" stopOpacity={0} />
|
||||
</RadialGradient>
|
||||
</Defs>
|
||||
<Rect x="0" y="0" width="2" height="2" fill="url(#sitsun)" />
|
||||
</Svg>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user