import React from "react"; import { View, Text, StyleSheet, Platform, TouchableOpacity, } from "react-native"; import { Ionicons } from "@expo/vector-icons"; import { useThemeContext } from "@/hooks/use-theme-context"; interface SectionCardProps { title: string; icon: keyof typeof Ionicons.glyphMap; children: React.ReactNode; count?: number; collapsible?: boolean; defaultExpanded?: boolean; } export default function SectionCard({ title, icon, children, count, collapsible = false, defaultExpanded = true, }: SectionCardProps) { const { colors } = useThemeContext(); const [expanded, setExpanded] = React.useState(defaultExpanded); const themedStyles = { container: { backgroundColor: colors.card, borderColor: colors.separator, }, title: { color: colors.text, }, count: { color: colors.textSecondary, backgroundColor: colors.backgroundSecondary, }, icon: colors.primary, }; return ( collapsible && setExpanded(!expanded)} activeOpacity={collapsible ? 0.7 : 1} disabled={!collapsible} > {title} {count !== undefined && ( {count} )} {collapsible && ( )} {expanded && {children}} ); } const styles = StyleSheet.create({ container: { borderRadius: 12, borderWidth: 1, marginBottom: 16, overflow: "hidden", }, header: { flexDirection: "row", alignItems: "center", justifyContent: "space-between", paddingHorizontal: 16, paddingVertical: 14, }, headerLeft: { flexDirection: "row", alignItems: "center", gap: 10, }, title: { fontSize: 16, fontWeight: "600", fontFamily: Platform.select({ ios: "System", android: "Roboto", default: "System", }), }, countBadge: { paddingHorizontal: 8, paddingVertical: 2, borderRadius: 10, minWidth: 24, alignItems: "center", }, countText: { fontSize: 12, fontWeight: "600", fontFamily: Platform.select({ ios: "System", android: "Roboto", default: "System", }), }, content: { paddingHorizontal: 16, paddingBottom: 16, }, });