diff options
| author | Jacob Richman <[email protected]> | 2025-08-12 14:05:49 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-12 21:05:49 +0000 |
| commit | d219f9013206aad5a1361e436ad4a45114e9cd49 (patch) | |
| tree | 58216dc659e809bc896b03de21a9a1c713126d6b /packages/cli/src/ui/components/ThemeDialog.tsx | |
| parent | 74fd0841d0d7148127e586fce4c550a01ff40e90 (diff) | |
Switch from useInput to useKeypress. (#6056)
Diffstat (limited to 'packages/cli/src/ui/components/ThemeDialog.tsx')
| -rw-r--r-- | packages/cli/src/ui/components/ThemeDialog.tsx | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/packages/cli/src/ui/components/ThemeDialog.tsx b/packages/cli/src/ui/components/ThemeDialog.tsx index 37663447..16ecfc8f 100644 --- a/packages/cli/src/ui/components/ThemeDialog.tsx +++ b/packages/cli/src/ui/components/ThemeDialog.tsx @@ -5,7 +5,7 @@ */ import React, { useCallback, useState } from 'react'; -import { Box, Text, useInput } from 'ink'; +import { Box, Text } from 'ink'; import { Colors } from '../colors.js'; import { themeManager, DEFAULT_THEME } from '../themes/theme-manager.js'; import { RadioButtonSelect } from './shared/RadioButtonSelect.js'; @@ -16,6 +16,7 @@ import { getScopeItems, getScopeMessageForSetting, } from '../../utils/dialogScopeUtils.js'; +import { useKeypress } from '../hooks/useKeypress.js'; interface ThemeDialogProps { /** Callback function when a theme is selected */ @@ -111,14 +112,17 @@ export function ThemeDialog({ 'theme', ); - useInput((input, key) => { - if (key.tab) { - setFocusedSection((prev) => (prev === 'theme' ? 'scope' : 'theme')); - } - if (key.escape) { - onSelect(undefined, selectedScope); - } - }); + useKeypress( + (key) => { + if (key.name === 'tab') { + setFocusedSection((prev) => (prev === 'theme' ? 'scope' : 'theme')); + } + if (key.name === 'escape') { + onSelect(undefined, selectedScope); + } + }, + { isActive: true }, + ); // Generate scope message for theme setting const otherScopeModifiedMessage = getScopeMessageForSetting( |
