/** * Base UI primitives for PixieSprout. * Pill, Card, Section, EmptyState, UiIcon, GardenChoiceChips, GardenMultiChips. */ import React from 'react'; import { StyleProp, StyleSheet, Text, TouchableOpacity, View, ViewStyle, } from 'react-native'; import { green, dark, pressWithHaptic } from '../constants/theme'; // ---- UiIcon ---- export function UiIcon({ label, size = 22, color = dark }: { label: string; size?: number; color?: string }) { return {label}; } // ---- Pill ---- export function Pill({ children, active = false }: { children: React.ReactNode; active?: boolean }) { return ( {children} ); } // ---- Card ---- export function Card({ children, style }: { children: React.ReactNode; style?: StyleProp }) { return {children}; } // ---- Section ---- export function Section({ title, badge, info }: { title: string; badge?: string; info?: boolean }) { return ( {title} {badge ? {badge} : null} {info ? : null} ); } // ---- EmptyState ---- export function EmptyState({ text }: { text: string }) { return ( {text} ); } // ---- GardenChoiceChips ---- export function GardenChoiceChips({ options, value, onChange }: { options: { value: T; label: string }[]; value: T | null; onChange: (value: T) => void }) { return ( {options.map(option => ( onChange(option.value))} > {option.label} ))} ); } // ---- GardenMultiChips ---- export function GardenMultiChips({ options, values, onToggle }: { options: { value: string; label: string }[]; values: string[]; onToggle: (value: string) => void }) { return ( {options.map(option => { const active = values.includes(option.value); return ( onToggle(option.value))} > {option.label} ); })} ); } // ---- Styles ---- const s = StyleSheet.create({ pill: { backgroundColor: '#F3F7E6', borderRadius: 999, paddingHorizontal: 10, paddingVertical: 3 }, pillActive: { backgroundColor: green }, pillText: { color: '#5B7553', fontSize: 12, fontWeight: '700' }, pillTextActive: { color: '#fff' }, card: { backgroundColor: 'rgba(255,253,247,0.96)', borderRadius: 18, borderWidth: 1, borderColor: 'rgba(191,217,180,0.95)', padding: 14, marginBottom: 10 }, sectionRow: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', marginBottom: 7, gap: 8 }, sectionTitleWrap: { flexDirection: 'row', alignItems: 'center', gap: 7, flex: 1, minWidth: 0 }, section: { color: dark, fontSize: 18, fontWeight: '900' }, sectionActions: { flexDirection: 'row', alignItems: 'center', gap: 8 }, body: { color: '#5B7553', fontSize: 14, lineHeight: 20 }, choiceWrap: { flexDirection: 'row', flexWrap: 'wrap', gap: 6, marginBottom: 10 }, choiceChip: { paddingHorizontal: 11, paddingVertical: 6, borderRadius: 999, borderWidth: 1, borderColor: 'rgba(191,217,180,0.95)', backgroundColor: '#FFFDF7' }, choiceChipActive: { backgroundColor: green, borderColor: green }, choiceText: { color: '#5B7553', fontSize: 13, fontWeight: '600' }, choiceTextActive: { color: '#fff' }, });