feat: 앱 시트·로그인 상태·지역 저장 틀, 공통 UI(Avatar·Chips·Rows·Credit)
This commit is contained in:
1 parent
e52f93fdbb
commit
28ff032160
8 files changed
+202
-15
No files matched your search
@@ -8,6 +8,7 @@ import { LinearGradient } from 'expo-linear-gradient';
|
||||
import Svg, { Defs, Path, RadialGradient, Rect, Stop } from 'react-native-svg';
|
||||
|
||||
import { Ic, Skel } from '@/components/ui';
|
||||
import { useSheet } from '@/lib/sheet';
|
||||
import { useSky } from '@/lib/sky';
|
||||
|
||||
type Mode = 'now' | TimeKind;
|
||||
@@ -48,6 +49,7 @@ function heroVal(load: Load, v: ReactNode, skel: string) {
|
||||
type Props = { hero?: HeroData | null; today?: ResWeatherToday; ranked: TopIndex[]; feedLoad: Load; todayLoad: Load };
|
||||
|
||||
export function Hero({ hero, today, ranked, feedLoad, todayLoad }: Props) {
|
||||
const { open } = useSheet();
|
||||
const { preview, setServerKind, setPreview } = useSky();
|
||||
const mode: Mode = preview ?? 'now';
|
||||
const t = kst(useNow());
|
||||
@@ -112,7 +114,13 @@ export function Hero({ hero, today, ranked, feedLoad, todayLoad }: Props) {
|
||||
</View>
|
||||
</View>
|
||||
<View className="items-center">
|
||||
{bubble ? <Text className={`text-center font-jua text-[24px] leading-tight ${text}`}>{bubble}</Text> : <Skel className="h-6 w-[160px]" />}
|
||||
{bubble ? (
|
||||
<Pressable disabled={!top1} onPress={() => top1 && open({ type: 'gak', indexId: top1.index_id })} accessibilityLabel={top1 ? `${bubble} 1위 ${top1.name} ${top1.score}점, 계산 근거 보기` : undefined}>
|
||||
<Text className={`text-center font-jua text-[24px] leading-tight ${text}`}>{bubble}</Text>
|
||||
</Pressable>
|
||||
) : (
|
||||
<Skel className="h-6 w-[160px]" />
|
||||
)}
|
||||
{top1?.summary ? <Text className={`mt-0.5 text-center text-[15px] font-bold opacity-80 ${text}`}>{top1.summary}</Text> : feedLoad === 'loading' ? <Skel className="mt-1 w-[140px]" /> : null}
|
||||
{/* 상태 한 줄: 습도·불쾌지수·자외선·미세먼지 단계 이름. 조심할 것만 색 */}
|
||||
{status.length > 0 && (
|
||||
|
||||
@@ -7,16 +7,18 @@ import { Pressable, Text, View } from 'react-native';
|
||||
|
||||
import { Ic, Rail, Sec, Skel, Thumb } from '@/components/ui';
|
||||
import { CARD_BG, BAND_BG } from '@/lib/colors';
|
||||
import { useSheet } from '@/lib/sheet';
|
||||
import { useSky } from '@/lib/sky';
|
||||
|
||||
const CARD = 'overflow-hidden rounded-[22px] border-b-[5px] border-shade bg-card';
|
||||
|
||||
/** 오늘의 각 순위: 동그라미 + 이름 + 점수. 지금 시간대가 아닌 각은 흐리게 */
|
||||
export function Stories({ items }: { items: TopIndex[] }) {
|
||||
const { open } = useSheet();
|
||||
return (
|
||||
<Rail>
|
||||
{items.map((g, i) => (
|
||||
<View key={g.index_id} accessibilityLabel={g.active ? `${g.rank}위 ${g.name} ${g.score}점` : `${g.name}, 지금 시간대 아님`} className={`w-[72px] items-center gap-1 ${g.active ? '' : 'opacity-55'}`}>
|
||||
<Pressable key={g.index_id} onPress={() => open({ type: 'gak', indexId: g.index_id })} accessibilityLabel={g.active ? `${g.rank}위 ${g.name} ${g.score}점` : `${g.name}, 지금 시간대 아님`} className={`w-[72px] items-center gap-1 ${g.active ? '' : 'opacity-55'}`}>
|
||||
<View className="size-[68px]">
|
||||
{!g.active || g.score < 50 ? (
|
||||
<View className="absolute inset-0 rounded-full bg-[#d6deea]" />
|
||||
@@ -32,7 +34,7 @@ export function Stories({ items }: { items: TopIndex[] }) {
|
||||
{g.name}
|
||||
</Text>
|
||||
{g.active ? <Text className="font-bagel text-[12.5px] leading-[14px] text-orange">{g.score}</Text> : <Text className="text-[11px] leading-[14px] font-extrabold text-ink3">지금 아님</Text>}
|
||||
</View>
|
||||
</Pressable>
|
||||
))}
|
||||
</Rail>
|
||||
);
|
||||
@@ -96,17 +98,18 @@ export function EventsBand({ events }: { events: BandEvent[] }) {
|
||||
}
|
||||
|
||||
export function TopBand({ items, sub }: { items: TopIndex[]; sub: string }) {
|
||||
const { open } = useSheet();
|
||||
return (
|
||||
<Band tone={2} title="지금 뜨는 각 TOP 5" sub={sub} to="/gak">
|
||||
<Rail>
|
||||
{items.slice(0, 5).map((g, i) => (
|
||||
<View key={g.index_id} className="w-[138px] gap-1 rounded-[22px] border-b-[5px] border-shade bg-card p-3">
|
||||
<Pressable key={g.index_id} onPress={() => open({ type: 'gak', indexId: g.index_id })} className="w-[138px] gap-1 rounded-[22px] border-b-[5px] border-shade bg-card p-3">
|
||||
{i < 3 ? <Ic name={MEDALS[i]} size={26} style={{ position: 'absolute', top: 8, left: 8 }} /> : <Text className="absolute top-2.5 left-3 font-jua text-ink3">{i + 1}위</Text>}
|
||||
<Ic name={g.icon} size={58} style={{ alignSelf: 'center' }} />
|
||||
<Text className="font-jua text-base text-ink">{g.name}</Text>
|
||||
<Text className="font-bagel text-[22px] leading-[24px] text-orange">{g.score}</Text>
|
||||
{g.summary && <Text className="text-xs font-semibold text-ink2">{g.summary}</Text>}
|
||||
</View>
|
||||
</Pressable>
|
||||
))}
|
||||
</Rail>
|
||||
</Band>
|
||||
@@ -115,11 +118,12 @@ export function TopBand({ items, sub }: { items: TopIndex[]; sub: string }) {
|
||||
|
||||
export function SeasonBand({ news }: { news: BandArticle[] }) {
|
||||
const bg = useCardBg();
|
||||
const { open } = useSheet();
|
||||
return (
|
||||
<Band tone={3} title="이번 주 계절 이야기" sub="예년 이맘때의 소식" to="/season">
|
||||
<Rail>
|
||||
{news.map((a) => (
|
||||
<View key={a.article_id} className={`w-[200px] ${CARD}`}>
|
||||
<Pressable key={a.article_id} onPress={() => open({ type: 'article', articleId: a.article_id })} className={`w-[200px] ${CARD}`}>
|
||||
<Thumb image={a.image} icon={a.icon} iconSize={76} className="h-[116px]">
|
||||
<LinearGradient colors={bg[cardBg(a.icon, a.article_id)]} style={{ position: 'absolute', inset: 0, zIndex: -1 }} />
|
||||
</Thumb>
|
||||
@@ -127,7 +131,7 @@ export function SeasonBand({ news }: { news: BandArticle[] }) {
|
||||
<Text className="font-jua text-[16.5px] leading-snug text-ink">{a.title}</Text>
|
||||
<Text className="text-[12.5px] font-semibold text-ink2">{a.meta}</Text>
|
||||
</View>
|
||||
</View>
|
||||
</Pressable>
|
||||
))}
|
||||
</Rail>
|
||||
</Band>
|
||||
|
||||
Reference in new issue
Block a user