Skip to content

Commit 413351b

Browse files
committed
fix(tablekit-react-datepicker): rtl issues
1 parent 2ec8c40 commit 413351b

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

system/react-datepicker/src/Header/MonthArrowButtons.tsx

+18-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
11
import { ChevronLeft, ChevronRight } from '@carbon/icons-react';
2+
import styled from '@emotion/styled';
23
import { IconButton, getConfigDefault } from '@tablecheck/tablekit-react';
34
import * as React from 'react';
45

56
import { useDatePickerContext } from '../Root';
67

8+
const IconWrapper = styled.span`
9+
display: flex;
10+
align-items: center;
11+
justify-content: center;
12+
& > svg {
13+
[dir='rtl'] & {
14+
transform: rotate(180deg);
15+
}
16+
}
17+
`;
18+
719
export const PreviousMonth = React.forwardRef<
820
HTMLButtonElement,
921
Omit<React.HTMLAttributes<HTMLButtonElement>, 'children'>
@@ -17,7 +29,9 @@ export const PreviousMonth = React.forwardRef<
1729
type="button"
1830
ref={ref}
1931
>
20-
<ChevronLeft size={getConfigDefault('iconSize')} />
32+
<IconWrapper>
33+
<ChevronLeft size={getConfigDefault('iconSize')} />
34+
</IconWrapper>
2135
</IconButton>
2236
);
2337
});
@@ -34,7 +48,9 @@ export const NextMonth = React.forwardRef<
3448
type="button"
3549
ref={ref}
3650
>
37-
<ChevronRight size={getConfigDefault('iconSize')} />
51+
<IconWrapper>
52+
<ChevronRight size={getConfigDefault('iconSize')} />
53+
</IconWrapper>
3854
</IconButton>
3955
);
4056
});

0 commit comments

Comments
 (0)