metrics page

This commit is contained in:
Stef-00012 2025-02-08 19:57:16 +01:00
parent 6eb65dc30d
commit cf38808be5
No known key found for this signature in database
GPG key ID: 28BE9A9E4EF0E6BF
21 changed files with 815 additions and 110 deletions

View file

@ -3,14 +3,23 @@ import Popup from "./Popup";
import DateTimePicker from 'react-native-ui-datepicker';
import type { DatePickeMultipleProps, DatePickerRangeProps, DatePickerSingleProps } from "react-native-ui-datepicker/lib/typescript/DateTimePicker";
import Button from "./Button";
import type { ReactNode } from "react";
type Props = (DatePickeMultipleProps | DatePickerRangeProps | DatePickerSingleProps) & {
open: boolean;
onClose: () => void | Promise<void>
onClose: () => void | Promise<void>;
children?: ReactNode
}
export default function DatePicker(props: Props) {
const defaultProps: Props = {
const {
open,
onClose,
children,
...datePickerProps
} = props;
const defaultProps = {
monthContainerStyle: styles.monthContainerStyle,
yearContainerStyle: styles.yearContainerStyle,
calendarTextStyle: styles.calendarTextStyle,
@ -23,13 +32,15 @@ export default function DatePicker(props: Props) {
displayFullDays: true,
firstDayOfWeek: 1,
locale: "en",
...props
}
...datePickerProps
};
return (
<Popup hidden={!props.open} onClose={props.onClose}>
<Popup hidden={!open} onClose={onClose}>
<DateTimePicker {...defaultProps}/>
{props.children}
<Button
text="Close"
onPress={props.onClose}