partner-next/src/components/DateFilters.tsx
2025-06-02 13:04:22 +03:00

32 lines
1.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React from "react";
import DateInput from "./DateInput";
import styles from "../styles/stat.module.css";
interface DateFiltersProps {
dateStart: string;
dateEnd: string;
onChange: (field: "dateStart" | "dateEnd", value: string) => void;
onApply: () => void;
onClear: () => void;
}
const DateFilters: React.FC<DateFiltersProps> = ({ dateStart, dateEnd, onChange, onApply, onClear }) => (
<div className={styles.filters}>
<DateInput
label="Дата начала"
value={dateStart}
onChange={e => onChange("dateStart", e.target.value)}
max={dateEnd || undefined}
/>
<DateInput
label="Дата окончания"
value={dateEnd}
onChange={e => onChange("dateEnd", e.target.value)}
min={dateStart || undefined}
/>
<button className={styles.filterBtn} onClick={onApply}>Применить</button>
<button className={styles.filterBtn} onClick={onClear}>Очистить фильтр</button>
</div>
);
export default DateFilters;