Fix NavSidebar resize for RTL languages
Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
This commit is contained in:
parent
7a182636d2
commit
cea5685aad
1 changed files with 3 additions and 1 deletions
|
@ -79,6 +79,7 @@ export function NavSidebar({
|
||||||
title,
|
title,
|
||||||
otherTabsUnreadStats,
|
otherTabsUnreadStats,
|
||||||
}: NavSidebarProps): JSX.Element {
|
}: NavSidebarProps): JSX.Element {
|
||||||
|
const isRTL = i18n.getLocaleDirection() === 'rtl';
|
||||||
const [dragState, setDragState] = useState(DragState.INITIAL);
|
const [dragState, setDragState] = useState(DragState.INITIAL);
|
||||||
|
|
||||||
const [preferredWidth, setPreferredWidth] = useState(() => {
|
const [preferredWidth, setPreferredWidth] = useState(() => {
|
||||||
|
@ -102,7 +103,8 @@ export function NavSidebar({
|
||||||
setDragState(DragState.DRAGEND);
|
setDragState(DragState.DRAGEND);
|
||||||
},
|
},
|
||||||
onMove(event) {
|
onMove(event) {
|
||||||
const { deltaX, shiftKey, pointerType } = event;
|
const { shiftKey, pointerType } = event;
|
||||||
|
const deltaX = isRTL ? -event.deltaX : event.deltaX;
|
||||||
const isKeyboard = pointerType === 'keyboard';
|
const isKeyboard = pointerType === 'keyboard';
|
||||||
const increment = isKeyboard && shiftKey ? 10 : 1;
|
const increment = isKeyboard && shiftKey ? 10 : 1;
|
||||||
setPreferredWidth(prevWidth => {
|
setPreferredWidth(prevWidth => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue