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,149 @@
|
||||
import type { EventData, PlaceData, WeekRankItem, DayData } from '@nalssigak/shared/api/client/types.gen';
|
||||
import { cardBg, dateRange } from '@nalssigak/shared/lib';
|
||||
import { LinearGradient } from 'expo-linear-gradient';
|
||||
import { Pressable, ScrollView, Text, View } from 'react-native';
|
||||
|
||||
import { Credit, Ic, MapLink, Thumb } from '@/components/ui';
|
||||
import { CARD_BG } from '@/lib/colors';
|
||||
import { useSky } from '@/lib/sky';
|
||||
|
||||
import { DAY_W, EVENT_CARD, PLACE_CARD } from './skels';
|
||||
|
||||
const PLACE_BG: Record<string, string> = { picnic: 'mint', walk: 'mint', sunset: 'dusk', chimaek: 'peach', photo: 'butter', bulb: 'lilac' };
|
||||
|
||||
function useBg() {
|
||||
const { kind } = useSky();
|
||||
return { night: kind === 'night', bg: CARD_BG[kind === 'night' ? 'night' : 'day'] };
|
||||
}
|
||||
|
||||
/** 열흘 날짜 줄: 누르면 그날 추천이 바뀐다 */
|
||||
export function DayStrip({ days, selected, onPick, dim }: { days: DayData[]; selected?: string; onPick: (day: string) => void; dim: boolean }) {
|
||||
const { night } = useBg();
|
||||
const red = night ? '#ff8db5' : '#d6457a';
|
||||
return (
|
||||
<ScrollView horizontal showsHorizontalScrollIndicator={false} contentContainerClassName="gap-1 px-3 pt-3" style={{ opacity: dim ? 0.6 : 1 }} accessibilityLabel="날짜 고르기">
|
||||
{days.map((d) => {
|
||||
const on = d.day === selected;
|
||||
const weekend = d.weekday === '토' || d.weekday === '일' || !!d.holiday;
|
||||
return (
|
||||
<Pressable key={d.day} accessibilityState={{ selected: on }} onPress={() => onPick(d.day)} className={`${DAY_W} items-center gap-0.5 rounded-[18px] pt-[9px] pb-2 ${on ? 'bg-ink-btn' : 'border-b-4 border-shade bg-card'}`}>
|
||||
<Text className={`text-xs font-extrabold ${on ? 'text-white' : weekend ? '' : 'text-ink2'}`} style={!on && weekend ? { color: red } : undefined}>
|
||||
{d.weekday}
|
||||
</Text>
|
||||
<Ic name={d.icon} size={28} />
|
||||
<Text className={`font-jua text-sm ${on ? 'text-white' : 'text-ink'}`}>{d.temp_max_c != null ? `${Math.round(d.temp_max_c)}°` : <Text className="opacity-50">?</Text>}</Text>
|
||||
<Text numberOfLines={1} className="px-0.5 text-[9.5px] font-extrabold" style={{ color: on ? '#ffb3c4' : red }}>
|
||||
{d.holiday ? d.holiday.replace(/\(.*\)/, '') : `${Number(d.day.slice(8))}일`}
|
||||
</Text>
|
||||
</Pressable>
|
||||
);
|
||||
})}
|
||||
</ScrollView>
|
||||
);
|
||||
}
|
||||
|
||||
/** 고른 날 추천 한 장 */
|
||||
export function PickCard({ day }: { day: DayData }) {
|
||||
const { night, bg } = useBg();
|
||||
return (
|
||||
<View className="mx-3 mt-3 flex-row items-center gap-3.5 overflow-hidden rounded-3xl border-b-[5px] border-shade p-4" accessibilityLiveRegion="polite">
|
||||
<LinearGradient colors={night ? bg.mint : ['#e9fbf2', '#ffffff']} style={{ position: 'absolute', inset: 0 }} />
|
||||
<Ic name={day.icon} size={64} />
|
||||
<View className="flex-1">
|
||||
<Text className="font-jua text-[19px] text-ink">{day.headline}</Text>
|
||||
<Text className="mt-0.5 text-[13.5px] font-semibold text-ink2">{day.summary}</Text>
|
||||
<Text className="mt-2 font-jua text-base text-ink">{day.pick}</Text>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
export function PlaceCard({ place: p, index }: { place: PlaceData; index: number }) {
|
||||
const { bg } = useBg();
|
||||
return (
|
||||
<View className={PLACE_CARD}>
|
||||
<Thumb image={p.image} icon={p.icon} iconSize={62} className="h-[104px]">
|
||||
<LinearGradient colors={bg[PLACE_BG[p.icon] ?? (p.is_outdoor ? 'mint' : cardBg(p.icon, index))]} style={{ position: 'absolute', inset: 0, zIndex: -1 }} />
|
||||
{p.is_good && (
|
||||
<View className={`absolute top-2.5 left-2.5 rounded-full px-2 py-[3px] ${p.is_outdoor ? 'bg-[#1f9d62]' : 'bg-rain'}`}>
|
||||
<Text className="text-[11.5px] font-extrabold text-white">{p.is_outdoor ? '오늘 딱' : '비 와도 OK'}</Text>
|
||||
</View>
|
||||
)}
|
||||
{p.image && p.image_credit && <Credit text={p.image_credit} />}
|
||||
</Thumb>
|
||||
<View className="px-3 pt-2.5 pb-3">
|
||||
<Text className="text-[11.5px] font-extrabold text-ink3">
|
||||
{p.area} · {p.distance_km}km · {p.is_outdoor ? '야외' : '실내'}
|
||||
</Text>
|
||||
<Text className="font-jua text-[16.5px] text-ink">
|
||||
<MapLink place={p.name}>{p.name}</MapLink>
|
||||
</Text>
|
||||
<Text className="text-[12.5px] leading-snug font-semibold text-ink2">
|
||||
{p.reason}
|
||||
{'\n'}추천 {p.best_time}
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
export function RankRow({ item: r, mine }: { item: WeekRankItem; mine: boolean }) {
|
||||
return (
|
||||
<View className={`flex-row items-center gap-2.5 border-b-[1.5px] border-line px-1 py-3 ${mine ? 'rounded-2xl bg-card' : ''}`}>
|
||||
<Text className="w-[34px] text-center font-bagel text-xl text-orange">{r.rank}</Text>
|
||||
<View className="min-w-0 flex-1">
|
||||
<Text numberOfLines={1} className="font-jua text-[17px] text-ink">
|
||||
{r.name}
|
||||
{mine && <Text className="text-xs font-extrabold text-rain"> 내 지역</Text>}
|
||||
</Text>
|
||||
<Text numberOfLines={1} className="text-[12.5px] font-semibold text-ink2">
|
||||
{r.reason}
|
||||
{r.estimated && ' · 예상'}
|
||||
</Text>
|
||||
<View className="mt-[5px] h-1.5 overflow-hidden rounded-full bg-[#eef1f6]">
|
||||
<LinearGradient colors={['#9be7c4', '#1f9d62']} start={{ x: 0, y: 0 }} end={{ x: 1, y: 0 }} style={{ height: '100%', width: `${r.score}%` }} />
|
||||
</View>
|
||||
</View>
|
||||
<View className="flex-row items-center gap-1">
|
||||
<Ic name={r.icon} size={24} />
|
||||
<Text className="font-jua text-base text-ink">{r.score}점</Text>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
export function EventRow({ event: e, index }: { event: EventData; index: number }) {
|
||||
const { night, bg } = useBg();
|
||||
const live = e.status === 'live';
|
||||
const rainy = e.fit?.includes('비');
|
||||
return (
|
||||
<View className={EVENT_CARD}>
|
||||
<Thumb image={e.image} icon={e.icon} iconSize={56} className="h-[84px] w-[84px] rounded-2xl">
|
||||
<LinearGradient colors={bg[cardBg(e.icon, index)]} style={{ position: 'absolute', inset: 0, zIndex: -1 }} />
|
||||
{e.image && e.image_credit && <Credit text={e.image_credit} />}
|
||||
</Thumb>
|
||||
{/* 이름 두 줄·정보 한 줄·날씨 한 줄로 고정해 카드 높이가 데이터와 무관하게 같다 */}
|
||||
<View className="min-w-0 flex-1">
|
||||
<Text numberOfLines={2} className="h-[46px] font-jua text-[17px] leading-snug text-ink">
|
||||
<Text className="text-[11px] font-extrabold" style={{ color: live ? (night ? '#4fd39a' : '#1f7a4f') : night ? '#ffab85' : '#c2471b', backgroundColor: live ? (night ? 'rgba(79,211,154,0.16)' : '#dff5ea') : night ? 'rgba(255,138,87,0.16)' : '#ffe8dc' }}>
|
||||
{` ${e.status_label} `}
|
||||
</Text>{' '}
|
||||
{e.name}
|
||||
</Text>
|
||||
<Text numberOfLines={1} className="text-[12.5px] font-semibold text-ink2">
|
||||
{dateRange(e.start_date, e.end_date)}
|
||||
{e.place_name && (
|
||||
<>
|
||||
{' · '}
|
||||
<MapLink place={e.place_name}>{e.place_name}</MapLink>
|
||||
</>
|
||||
)}
|
||||
{!e.is_confirmed && ' · 일정 확인 필요'}
|
||||
</Text>
|
||||
<Text numberOfLines={1} className="mt-[5px] text-xs font-extrabold" style={{ color: rainy ? (night ? '#ff8db5' : '#d6457a') : night ? '#4fd39a' : '#1f9d62' }}>
|
||||
{e.fit ?? ' '}
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
import { View } from 'react-native';
|
||||
|
||||
import { Skel } from '@/components/ui';
|
||||
|
||||
const TEN = Array.from({ length: 10 }, (_, i) => i);
|
||||
const THREE = [0, 1, 2];
|
||||
|
||||
export const DAY_W = 'w-[46px]';
|
||||
export const PLACE_CARD = 'w-[178px] overflow-hidden rounded-[22px] border-b-[5px] border-shade bg-card';
|
||||
export const EVENT_CARD = 'mx-3 mt-2.5 flex-row items-center gap-3 rounded-[22px] border-b-[5px] border-shade bg-card p-3';
|
||||
|
||||
export function DaysSkel() {
|
||||
return (
|
||||
<View className="flex-row gap-1 overflow-hidden px-3 pt-3">
|
||||
{TEN.map((i) => (
|
||||
<View key={i} className={`${DAY_W} items-center gap-1 rounded-[18px] border-b-4 border-shade bg-card pt-[9px] pb-2`}>
|
||||
<Skel className="w-3" />
|
||||
<View className="size-7 rounded-full bg-skel" />
|
||||
<Skel className="w-6" />
|
||||
<Skel className="w-5" />
|
||||
</View>
|
||||
))}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
export function PickSkel() {
|
||||
return (
|
||||
<View className="mx-3 mt-3 flex-row items-center gap-3.5 rounded-3xl border-b-[5px] border-shade bg-card p-4">
|
||||
<View className="size-16 rounded-full bg-skel" />
|
||||
<View className="flex-1 gap-1.5">
|
||||
<Skel className="h-4 w-32" />
|
||||
<Skel className="w-4/5" />
|
||||
<Skel className="mt-1 w-36" />
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
export function PlacesSkel() {
|
||||
return (
|
||||
<View className="flex-row gap-2.5 overflow-hidden px-4 pt-3 pb-1">
|
||||
{THREE.map((i) => (
|
||||
<View key={i} className={PLACE_CARD}>
|
||||
<View className="h-[104px] bg-skel" />
|
||||
<View className="gap-1.5 px-3 pt-2.5 pb-3">
|
||||
<Skel className="w-16" />
|
||||
<Skel className="h-4 w-24" />
|
||||
<Skel className="w-full" />
|
||||
<Skel className="w-20" />
|
||||
</View>
|
||||
</View>
|
||||
))}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
export function EventSkel() {
|
||||
return (
|
||||
<View className={EVENT_CARD}>
|
||||
<View className="h-[84px] w-[84px] rounded-2xl bg-skel" />
|
||||
<View className="flex-1 gap-1.5">
|
||||
<Skel className="h-4 w-40" />
|
||||
<Skel className="h-4 w-20" />
|
||||
<Skel className="w-44" />
|
||||
<Skel className="w-24" />
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
export function EventsSkel() {
|
||||
return (
|
||||
<>
|
||||
{THREE.map((i) => (
|
||||
<EventSkel key={i} />
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export function RankSkel() {
|
||||
return (
|
||||
<View className="mx-3 mt-1.5">
|
||||
{TEN.map((i) => (
|
||||
<View key={i} className="flex-row items-center gap-2.5 border-b-[1.5px] border-line px-1 py-3">
|
||||
<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 className="h-1.5 rounded-full bg-skel" />
|
||||
</View>
|
||||
<View className="flex-row items-center gap-1">
|
||||
<View className="size-6 rounded-full bg-skel" />
|
||||
<Skel className="w-9" />
|
||||
</View>
|
||||
</View>
|
||||
))}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user