import type { ReactNode } from "react"; import { Pressable, View, type StyleProp, type ViewStyle, } from "react-native"; import { Ionicons } from "@expo/vector-icons"; import { Text } from "@/components/ui/Text"; import { colors, radii, shadows, space } from "@/lib/theme"; export function Card({ children, onPress, padded = true, tone = "surface", elevated = true, style, }: { children: ReactNode; onPress?: () => void; padded?: boolean; tone?: "surface" | "wash" | "brand"; elevated?: boolean; style?: StyleProp; }) { const bg = tone === "wash" ? colors.surfaceAlt : tone === "brand" ? colors.brandWash : colors.surface; const base: StyleProp = [ { backgroundColor: bg, borderRadius: radii.card, borderWidth: 1, borderColor: tone === "brand" ? colors.brandBorder : colors.line, padding: padded ? space.lg : 0, overflow: "hidden", }, elevated && tone === "surface" ? shadows.xs : null, style, ]; if (!onPress) return {children}; return ( [base, pressed && { opacity: 0.92 }]} > {children} ); } export function SectionHeader({ title, action, onAction, style, }: { title: string; action?: string; onAction?: () => void; style?: StyleProp; }) { return ( {title} {action ? ( {action} ) : null} ); } export function Section({ title, action, onAction, children, style, }: { title?: string; action?: string; onAction?: () => void; children: ReactNode; style?: StyleProp; }) { return ( {title ? : null} {children} ); } export function Divider({ style }: { style?: StyleProp }) { return ; } /** Key/value row used for drug facts and order summaries. */ export function InfoRow({ label, value, valueColor, emphasis, last, }: { label: string; value: string; valueColor?: string; emphasis?: boolean; last?: boolean; }) { return ( {label} {value} ); } /** Tappable settings/menu row with icon tile, title and chevron. */ export function MenuRow({ icon, title, subtitle, onPress, right, tone = "brand", last, }: { icon: keyof typeof Ionicons.glyphMap; title: string; subtitle?: string; onPress?: () => void; right?: ReactNode; tone?: "brand" | "danger" | "neutral"; last?: boolean; }) { const iconBg = tone === "danger" ? colors.dangerSoft : tone === "neutral" ? colors.surfaceAlt : colors.brandSoft; const iconFg = tone === "danger" ? colors.danger : tone === "neutral" ? colors.muted : colors.brandText; return ( ({ flexDirection: "row", alignItems: "center", gap: 14, paddingVertical: 14, paddingHorizontal: space.lg, borderBottomWidth: last ? 0 : 1, borderBottomColor: colors.line, backgroundColor: pressed ? colors.surfaceAlt : "transparent", })} > {title} {subtitle ? ( {subtitle} ) : null} {right ?? } ); }