RTL
This commit is contained in:
parent
1f2cde6d04
commit
0e490542a7
196 changed files with 2117 additions and 1217 deletions
20
ts/util/keyboard.ts
Normal file
20
ts/util/keyboard.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
// Copyright 2021 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import type { LocaleDirection } from '../../app/locale';
|
||||
|
||||
export type LogicalDirection = 'start' | 'end';
|
||||
export type HorizontalArrowKey = 'ArrowLeft' | 'ArrowRight';
|
||||
|
||||
const logicalArrows: Record<
|
||||
LogicalDirection,
|
||||
Record<LocaleDirection, HorizontalArrowKey>
|
||||
> = {
|
||||
start: { ltr: 'ArrowLeft', rtl: 'ArrowRight' },
|
||||
end: { ltr: 'ArrowRight', rtl: 'ArrowLeft' },
|
||||
};
|
||||
|
||||
export function arrow(logicalDirection: LogicalDirection): HorizontalArrowKey {
|
||||
const localeDirection = window.getResolvedMessagesLocaleDirection();
|
||||
return logicalArrows[logicalDirection][localeDirection];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue