Files
ServiceManager/frontend/node_modules/react-day-picker/src/components/Day/Day.tsx
2026-01-01 17:40:53 +01:00

31 lines
837 B
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 { useRef } from 'react';
import { useDayRender } from 'hooks/useDayRender';
import { Button } from '../Button';
/** Represent the props used by the {@link Day} component. */
export interface DayProps {
/** The month where the date is displayed. */
displayMonth: Date;
/** The date to render. */
date: Date;
}
/**
* The content of a day cell as a button or span element according to its
* modifiers.
*/
export function Day(props: DayProps): JSX.Element {
const buttonRef = useRef<HTMLButtonElement>(null);
const dayRender = useDayRender(props.date, props.displayMonth, buttonRef);
if (dayRender.isHidden) {
return <div role="gridcell"></div>;
}
if (!dayRender.isButton) {
return <div {...dayRender.divProps} />;
}
return <Button name="day" ref={buttonRef} {...dayRender.buttonProps} />;
}