1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-03-30 18:25:57 -04:00
Files
Radarr/frontend/src/Calendar/Header/CalendarHeaderViewButton.tsx
Bogdan 3f35b7c782 Convert Calendar to TypeScript
(cherry picked from commit 811eb36c7b1a5124270ff93d18d16944e654de81)

Co-authored-by: Mark McDowall <mark@mcdowall.ca>

Closes #10764
Closes #10776
Closes #10781
2025-05-29 17:14:07 +03:00

35 lines
819 B
TypeScript

import React, { useCallback } from 'react';
import { CalendarView } from 'Calendar/calendarViews';
import Button, { ButtonProps } from 'Components/Link/Button';
import titleCase from 'Utilities/String/titleCase';
interface CalendarHeaderViewButtonProps
extends Omit<ButtonProps, 'children' | 'onPress'> {
view: CalendarView;
selectedView: CalendarView;
onPress: (view: CalendarView) => void;
}
function CalendarHeaderViewButton({
view,
selectedView,
onPress,
...otherProps
}: CalendarHeaderViewButtonProps) {
const handlePress = useCallback(() => {
onPress(view);
}, [view, onPress]);
return (
<Button
isDisabled={selectedView === view}
{...otherProps}
onPress={handlePress}
>
{titleCase(view)}
</Button>
);
}
export default CalendarHeaderViewButton;