Fix NavSidebar resize for RTL languages

Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
This commit is contained in:
ayumi-signal 2023-11-21 13:09:59 -08:00 committed by GitHub
parent 7a182636d2
commit cea5685aad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -79,6 +79,7 @@ export function NavSidebar({
title,
otherTabsUnreadStats,
}: NavSidebarProps): JSX.Element {
const isRTL = i18n.getLocaleDirection() === 'rtl';
const [dragState, setDragState] = useState(DragState.INITIAL);
const [preferredWidth, setPreferredWidth] = useState(() => {
@ -102,7 +103,8 @@ export function NavSidebar({
setDragState(DragState.DRAGEND);
},
onMove(event) {
const { deltaX, shiftKey, pointerType } = event;
const { shiftKey, pointerType } = event;
const deltaX = isRTL ? -event.deltaX : event.deltaX;
const isKeyboard = pointerType === 'keyboard';
const increment = isKeyboard && shiftKey ? 10 : 1;
setPreferredWidth(prevWidth => {