import React from 'react'; import { StyleSheet, Text, TouchableOpacity, View } from 'react-native'; export type TaskFilterType = 'all' | 'pending' | 'completed' | 'skipped'; interface TaskFilterTabsProps { selectedFilter: TaskFilterType; onFilterChange: (filter: TaskFilterType) => void; taskCounts: { all: number; pending: number; completed: number; skipped: number; }; } export const TaskFilterTabs: React.FC = ({ selectedFilter, onFilterChange, taskCounts, }) => { return ( {/* 全部 Tab */} onFilterChange('all')} > 全部 {taskCounts.all} {/* 待完成 Tab */} onFilterChange('pending')} > 待完成 {taskCounts.pending} {/* 已完成 Tab */} onFilterChange('completed')} > 已完成 {taskCounts.completed} {/* 已跳过 Tab */} onFilterChange('skipped')} > 已跳过 {taskCounts.skipped} ); }; const styles = StyleSheet.create({ container: { paddingHorizontal: 20, }, tabContainer: { backgroundColor: '#FFFFFF', borderRadius: 24, padding: 4, flexDirection: 'row', shadowColor: '#000', shadowOffset: { width: 0, height: 1 }, shadowOpacity: 0.05, shadowRadius: 2, elevation: 1, borderWidth: 1, borderColor: '#E5E7EB', }, tab: { flex: 1, flexDirection: 'row', alignItems: 'center', justifyContent: 'center', paddingVertical: 10, paddingHorizontal: 12, borderRadius: 20, gap: 6, }, activeTab: { backgroundColor: '#7A5AF8', shadowColor: '#7A5AF8', shadowOffset: { width: 0, height: 2 }, shadowOpacity: 0.2, shadowRadius: 4, elevation: 3, }, tabText: { fontSize: 14, fontWeight: '500', color: '#374151', }, activeTabText: { color: '#FFFFFF', fontWeight: '600', }, badge: { minWidth: 20, height: 20, borderRadius: 10, alignItems: 'center', justifyContent: 'center', paddingHorizontal: 6, }, inactiveBadge: { backgroundColor: '#E5E7EB', }, activeBadge: { backgroundColor: '#EF4444', }, badgeText: { fontSize: 12, fontWeight: '600', color: '#374151', }, activeBadgeText: { color: '#FFFFFF', }, });