Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { MiniChevronLeftIcon } from '@codecademy/gamut-icons';
import {
MiniChevronLeftIcon,
MiniChevronRightIcon,
} from '@codecademy/gamut-icons';
import { useElementDir } from '@codecademy/gamut-styles';
import * as React from 'react';

import { IconButton } from '../../../Button';
Expand All @@ -17,6 +21,7 @@ export const CalendarNavLastMonth: React.FC<CalendarNavProps> = ({
const resolvedLocale = useResolvedLocale(locale);
const { lastMonth } = getRelativeMonthLabels(resolvedLocale);
const buttonRef = React.useRef<HTMLButtonElement>(null);
const isRtl = useElementDir(buttonRef) === 'rtl';

const handleClick = (e: React.MouseEvent) => {
const lastMonth = new Date(
Expand All @@ -43,7 +48,7 @@ export const CalendarNavLastMonth: React.FC<CalendarNavProps> = ({
alignSelf="flex-start"
aria-label={lastMonth}
data-calendar-month-nav
icon={MiniChevronLeftIcon}
icon={isRtl ? MiniChevronRightIcon : MiniChevronLeftIcon}
ref={buttonRef}
size="small"
tip={lastMonth}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { MiniChevronRightIcon } from '@codecademy/gamut-icons';
import {
MiniChevronLeftIcon,
MiniChevronRightIcon,
} from '@codecademy/gamut-icons';
import { useElementDir } from '@codecademy/gamut-styles';
import * as React from 'react';

import { IconButton } from '../../../Button';
Expand All @@ -17,6 +21,7 @@ export const CalendarNavNextMonth: React.FC<CalendarNavProps> = ({
const resolvedLocale = useResolvedLocale(locale);
const { nextMonth } = getRelativeMonthLabels(resolvedLocale);
const buttonRef = React.useRef<HTMLButtonElement>(null);
const isRtl = useElementDir(buttonRef) === 'rtl';

const handleClick = (e: React.MouseEvent) => {
const nextMonth = new Date(
Expand All @@ -43,7 +48,7 @@ export const CalendarNavNextMonth: React.FC<CalendarNavProps> = ({
alignSelf="flex-end"
aria-label={nextMonth}
data-calendar-month-nav
icon={MiniChevronRightIcon}
icon={isRtl ? MiniChevronLeftIcon : MiniChevronRightIcon}
ref={buttonRef}
size="small"
tip={nextMonth}
Expand Down
Loading