Files
frontend/src/entities/bank-card/ui/BankPeriodPicker.tsx
T
ksv741 3eafad2657
Frontend security / security (push) Successful in 9s
Frontend verify / verify (push) Failing after 37m50s
Frontend security / security (pull_request) Successful in 9s
Frontend verify / verify (pull_request) Failing after 42m10s
Conventional commits / commits (pull_request) Successful in 29s
chore: finish frontend ESLint migration #18
Enable every plugin recommended preset and replace Biome with ESLint formatting.

Preserve API contracts and JSX whitespace; verify source, tests, builds and tooling.
2026-09-28 07:31:28 +03:00

39 lines
1.0 KiB
TypeScript

import { DatePickerInput } from "@mantine/dates";
import { type FC, useState } from "react";
import { useTranslation } from "react-i18next";
type BankPeriodPickerProps = {
onChange: (value: [null | string, null | string]) => void;
period: { from: string; to: string };
};
const BankPeriodPicker: FC<BankPeriodPickerProps> = (props) => {
const { onChange, period } = props;
const { t } = useTranslation();
const scope = `${period.from}-${period.to}`;
const [draft, setDraft] = useState<{
scope: string;
value: [null | string, null | string];
}>();
const value: [null | string, null | string]
= draft?.scope === scope ? draft.value : [period.from, period.to];
return (
<DatePickerInput
allowSingleDateInRange
label={t("bank.period")}
onChange={(next) => {
setDraft({ scope, value: next });
onChange(next);
}}
popoverProps={{
middlewares: { shift: { crossAxis: true } },
returnFocus: true,
}}
type="range"
value={value}
valueFormat="DD.MM.YYYY"
/>
);
};
export { BankPeriodPicker };