diff options
| author | Oliver <oliver@mohlin.dev> | 2025-10-06 14:20:24 +0200 |
|---|---|---|
| committer | Tobias Järvelöv <tobias.jarvelov@mullvad.net> | 2025-10-07 11:35:59 +0200 |
| commit | ccb2ca36609d235cef494f0ddb1e2570bf90c29e (patch) | |
| tree | 65b1c92bbf32ad7c4e50b08a0bf548e5b36b7e78 | |
| parent | b42549210353fbc8a92f4bd6c0d6fae2c8e7368c (diff) | |
| download | mullvadvpn-ccb2ca36609d235cef494f0ddb1e2570bf90c29e.tar.xz mullvadvpn-ccb2ca36609d235cef494f0ddb1e2570bf90c29e.zip | |
Rename options keyboard navigation hooks and types
| -rw-r--r-- | desktop/packages/mullvad-vpn/src/renderer/lib/hooks/index.ts | 2 | ||||
| -rw-r--r-- | desktop/packages/mullvad-vpn/src/renderer/lib/hooks/use-handle-options-keyboard-navigation.ts (renamed from desktop/packages/mullvad-vpn/src/renderer/lib/hooks/use-handle-keyboard-navigation.ts) | 6 | ||||
| -rw-r--r-- | desktop/packages/mullvad-vpn/src/renderer/lib/hooks/use-options.ts | 9 |
3 files changed, 10 insertions, 7 deletions
diff --git a/desktop/packages/mullvad-vpn/src/renderer/lib/hooks/index.ts b/desktop/packages/mullvad-vpn/src/renderer/lib/hooks/index.ts index acdfcad376..ca824aae46 100644 --- a/desktop/packages/mullvad-vpn/src/renderer/lib/hooks/index.ts +++ b/desktop/packages/mullvad-vpn/src/renderer/lib/hooks/index.ts @@ -1,5 +1,5 @@ export * from './use-exclusive-task'; export * from './use-focus-option-by-index'; export * from './use-get-initial-focus-index'; -export * from './use-handle-keyboard-navigation'; +export * from './use-handle-options-keyboard-navigation'; export * from './use-options'; diff --git a/desktop/packages/mullvad-vpn/src/renderer/lib/hooks/use-handle-keyboard-navigation.ts b/desktop/packages/mullvad-vpn/src/renderer/lib/hooks/use-handle-options-keyboard-navigation.ts index c42d4978df..46862e8f81 100644 --- a/desktop/packages/mullvad-vpn/src/renderer/lib/hooks/use-handle-keyboard-navigation.ts +++ b/desktop/packages/mullvad-vpn/src/renderer/lib/hooks/use-handle-options-keyboard-navigation.ts @@ -4,9 +4,9 @@ import { getOptions } from '../utils'; import { useFocusOptionByIndex } from './use-focus-option-by-index'; import { useGetInitialFocusIndex } from './use-get-initial-focus-index'; -export type Orientation = 'horizontal' | 'vertical'; +export type KeyboardNavigationOrientation = 'horizontal' | 'vertical'; -export const useHandleKeyboardNavigation = <T extends HTMLElement>({ +export const useHandleOptionsKeyboardNavigation = <T extends HTMLElement>({ optionsRef, focusedIndex, setFocusedIndex, @@ -16,7 +16,7 @@ export const useHandleKeyboardNavigation = <T extends HTMLElement>({ optionsRef: React.RefObject<T | null>; focusedIndex?: number; setFocusedIndex: (index: number) => void; - orientation?: Orientation; + orientation?: KeyboardNavigationOrientation; selector: string; }) => { const getInitialFocusIndex = useGetInitialFocusIndex({ optionsRef, focusedIndex, selector }); diff --git a/desktop/packages/mullvad-vpn/src/renderer/lib/hooks/use-options.ts b/desktop/packages/mullvad-vpn/src/renderer/lib/hooks/use-options.ts index 8f673c9765..506a7846f9 100644 --- a/desktop/packages/mullvad-vpn/src/renderer/lib/hooks/use-options.ts +++ b/desktop/packages/mullvad-vpn/src/renderer/lib/hooks/use-options.ts @@ -1,14 +1,17 @@ import React from 'react'; import { getInitialOption, getOptions } from '../utils'; -import { Orientation, useHandleKeyboardNavigation } from './use-handle-keyboard-navigation'; +import { + KeyboardNavigationOrientation, + useHandleOptionsKeyboardNavigation, +} from './use-handle-options-keyboard-navigation'; export type UseOptionsProps<T extends HTMLElement> = { optionsRef: React.RefObject<T | null>; focusedIndex?: number; setFocusedIndex: React.Dispatch<React.SetStateAction<number | undefined>>; selector: string; - orientation?: Orientation; + orientation?: KeyboardNavigationOrientation; }; export function useOptions<T extends HTMLElement>({ @@ -35,7 +38,7 @@ export function useOptions<T extends HTMLElement>({ [optionsRef, selector], ); - const handleKeyboardNavigation = useHandleKeyboardNavigation({ + const handleKeyboardNavigation = useHandleOptionsKeyboardNavigation({ optionsRef, setFocusedIndex, focusedIndex, |
