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,101 @@
|
||||
import type { ArticleSummary, ResSeasonWeek } from '@nalssigak/shared/api/client/types.gen';
|
||||
import { ARTICLE_LABEL, cardBg, dateRange, shortDay } from '@nalssigak/shared/lib';
|
||||
import { LinearGradient } from 'expo-linear-gradient';
|
||||
import { Pressable, Text, View } from 'react-native';
|
||||
|
||||
import { Credit, Ic, Skel, Thumb } from '@/components/ui';
|
||||
import { CARD_BG } from '@/lib/colors';
|
||||
import { useSky } from '@/lib/sky';
|
||||
|
||||
const HEAD_BOX = 'mx-3 mt-3 min-h-[250px] overflow-hidden rounded-[28px] p-5';
|
||||
const ROW = 'flex-row items-center gap-3 border-b-[1.5px] border-line px-4 py-3.5';
|
||||
const ROW_SKELS = [0, 1, 2, 3];
|
||||
|
||||
// 분류 글자색 (웹 ARTICLE_CAT). 밤엔 밝게
|
||||
const CAT_COLOR: Record<number, [string, string]> = { 1: ['#1f9d62', '#4fd39a'], 2: ['#7a5cd6', '#b9a6ff'], 3: ['#ff7a45', '#ff8a57'] };
|
||||
|
||||
/** 특집 상자와 같은 틀: 머리말 · 제목 두 줄 · 시 한 줄 · 절기 막대 */
|
||||
export function HeadSkel() {
|
||||
return (
|
||||
<View className={`${HEAD_BOX} gap-1.5 bg-card`}>
|
||||
<Skel className="w-36" />
|
||||
<Skel className="mt-1 h-7 w-[62%]" />
|
||||
<Skel className="h-7 w-[40%]" />
|
||||
<Skel className="mt-auto h-5 w-[72%]" />
|
||||
<Skel className="mt-2.5 w-[70%]" />
|
||||
<View className="h-[7px] w-[70%] rounded-full bg-skel" />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
export function RowsSkel() {
|
||||
return (
|
||||
<>
|
||||
{ROW_SKELS.map((i) => (
|
||||
<View key={i} className={ROW}>
|
||||
<View className="flex-1 gap-1.5">
|
||||
<Skel className="w-12" />
|
||||
<Skel className="h-4 w-48" />
|
||||
<Skel className="w-14" />
|
||||
</View>
|
||||
<View className="h-[84px] w-[84px] rounded-[18px] bg-skel" />
|
||||
</View>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
/** 이번 주 특집: 제목·시·절기 막대. 누르면 이번 주 절기 창 */
|
||||
export function SeasonHead({ week: w, onPress }: { week: ResSeasonWeek; onPress: () => void }) {
|
||||
const { kind } = useSky();
|
||||
const night = kind === 'night';
|
||||
const progress = Math.round((w.progress ?? 0) * 100);
|
||||
const poem = w.poem_lines ?? [];
|
||||
return (
|
||||
<Pressable onPress={onPress} className={HEAD_BOX}>
|
||||
<LinearGradient colors={CARD_BG[night ? 'night' : 'day'].peach} style={{ position: 'absolute', inset: 0 }} />
|
||||
<Ic name="maple" size={140} style={{ position: 'absolute', top: '18%', right: 14, width: '38%' }} />
|
||||
<Text className="text-[13px] font-extrabold text-ink opacity-75">이번 주 특집{w.start && w.end ? ` · ${dateRange(w.start, w.end)}` : ''}</Text>
|
||||
<Text className="mt-1 max-w-[62%] font-jua text-[29px] leading-tight text-ink">{w.headline}</Text>
|
||||
{poem.length > 0 && <Text className="mt-auto max-w-[72%] pt-3 text-[22px] leading-[37px] text-ink">{poem.join('\n')}</Text>}
|
||||
{w.term_now && w.term_next && (
|
||||
<View className={`max-w-[70%] ${poem.length ? 'mt-2.5' : 'mt-auto'}`}>
|
||||
<View className="flex-row justify-between">
|
||||
<Text className="text-xs font-extrabold text-ink2">
|
||||
{w.term_now.name} {shortDay(w.term_now.day)}
|
||||
</Text>
|
||||
<Text className="text-xs font-extrabold text-ink2">
|
||||
{w.term_next.name} {shortDay(w.term_next.day)}
|
||||
</Text>
|
||||
</View>
|
||||
<View className="mt-1 h-[7px] overflow-hidden rounded-full bg-[rgb(40_48_74/0.1)]" accessibilityRole="image" accessibilityLabel={`다음 절기까지 ${progress}% 지났어요`}>
|
||||
<View className="h-full bg-orange" style={{ width: `${progress}%` }} />
|
||||
</View>
|
||||
</View>
|
||||
)}
|
||||
</Pressable>
|
||||
);
|
||||
}
|
||||
|
||||
export function ArticleRow({ article: a, onPress }: { article: ArticleSummary; onPress: () => void }) {
|
||||
const { kind } = useSky();
|
||||
const night = kind === 'night';
|
||||
const color = CAT_COLOR[a.category]?.[night ? 1 : 0];
|
||||
return (
|
||||
<Pressable onPress={onPress} className={ROW}>
|
||||
<View className="flex-1">
|
||||
{ARTICLE_LABEL[a.category] && (
|
||||
<Text className="text-xs font-extrabold" style={{ color }}>
|
||||
{ARTICLE_LABEL[a.category]}
|
||||
</Text>
|
||||
)}
|
||||
<Text className="mt-0.5 font-jua text-[17.5px] leading-snug text-ink">{a.title}</Text>
|
||||
<Text className="mt-1 text-xs font-semibold text-ink3">{a.read_minutes}분 읽기</Text>
|
||||
</View>
|
||||
<Thumb image={a.image} icon={a.icon} iconSize={54} className="h-[84px] w-[84px] rounded-[18px]">
|
||||
<LinearGradient colors={CARD_BG[night ? 'night' : 'day'][cardBg(a.icon, a.article_id)]} style={{ position: 'absolute', inset: 0, zIndex: -1 }} />
|
||||
{a.image && a.image_credit && <Credit text={a.image_credit} />}
|
||||
</Thumb>
|
||||
</Pressable>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user