1 import { useMemo } from 'react';
3 import { format } from 'date-fns';
4 import { c } from 'ttag';
6 import { Button, Vr } from '@proton/atoms';
7 import { Icon, ToolbarButton } from '@proton/components';
8 import type { VIEWS } from '@proton/shared/lib/calendar/constants';
9 import { dateLocale } from '@proton/shared/lib/i18n';
11 import { getNavigationArrowsText } from '../helpers/i18n';
22 const DateCursorButtons = ({ view, now, onToday, onPrev, onNext, currentRange }: Props) => {
23 const todayTitle = useMemo(() => {
24 return format(now, 'PP', { locale: dateLocale });
25 }, [now, dateLocale]);
27 const { previous, next } = getNavigationArrowsText(view);
31 <span className="md:hidden current-range my-auto block text-bold text-ellipsis" title={currentRange}>
34 <span className="flex flex-nowrap ml-auto md:ml-0">
35 <span className="md:hidden shrink-0 flex flex-nowrap">
37 data-testid="calendar-toolbar:today"
38 className="shrink-0 items-centers"
42 <Icon name="calendar-today" alt={c('Action').t`Today`} />
45 <Vr className="mx-1 md:hidden" />
48 data-testid="calendar-toolbar:today"
49 className="shrink-0 hidden md:inline-flex mr-2"
53 {c('Action').t`Today`}
56 data-testid="calendar-toolbar:previous"
59 icon={<Icon name="chevron-left" className="m-auto toolbar-icon" />}
61 <span className="sr-only">{previous}</span>
64 data-testid="calendar-toolbar:next"
67 icon={<Icon name="chevron-right" className="m-auto toolbar-icon" />}
69 <span className="sr-only">{next}</span>
72 className="hidden md:block current-range ml-2 my-auto text-bold text-xl text-ellipsis"
82 export default DateCursorButtons;