import React from "react"; import { View, Text, TouchableOpacity, StyleSheet, ScrollView, } from "react-native"; import type { CalendarTheme } from "../types/theme"; import { DATE_PRESETS, getPresetValue } from "../utils/presets"; export interface DateRangePresetsProps { onPresetSelect: (range: { start: Date; end: Date }) => void; presets?: string[]; theme?: CalendarTheme; } export function DateRangePresets({ onPresetSelect, presets = [ "today", "yesterday", "last7days", "last30days", "thisWeek", "thisMonth", ], theme, }: DateRangePresetsProps) { return ( {presets.map((presetKey) => { const preset = DATE_PRESETS[presetKey]; if (!preset) return null; return ( { const value = getPresetValue(presetKey); if (value) onPresetSelect(value); }} accessibilityLabel={preset.label} accessibilityRole="button" > {preset.label} ); })} ); } const styles = StyleSheet.create({ container: { maxHeight: 50, }, content: { paddingHorizontal: 16, paddingVertical: 8, gap: 8, }, presetButton: { paddingHorizontal: 16, paddingVertical: 8, borderRadius: 20, borderWidth: 1, borderColor: "#E0E0E0", }, presetText: { fontSize: 14, fontWeight: "500", }, });