Skip to content

Commit e8e5844

Browse files
committed
tweak: add a label to hotkeys that behave differently in outline mode
1 parent f3ce4a9 commit e8e5844

2 files changed

Lines changed: 33 additions & 5 deletions

File tree

src/view/components/container/controls-bar/modals/hotkeys/components/command.svelte

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,27 @@
33
import { StatefulViewCommand } from 'src/view/actions/keyboard-shortcuts/helpers/commands/default-view-hotkeys';
44
import {
55
DynamicLabelState,
6-
getDynamicLabel
6+
getDynamicLabel,
7+
HotkeysThatBehaveDifferentlyInOutlineMode
78
} from 'src/view/components/container/controls-bar/modals/hotkeys/components/helpers/get-dynamic-label';
9+
import { Info } from 'lucide-svelte';
810
911
export let commandHotkeys: StatefulViewCommand;
10-
export let labelState: DynamicLabelState
12+
export let labelState: DynamicLabelState;
1113
</script>
1214

1315
<div class="command">
14-
<span class="label">{getDynamicLabel(labelState,commandHotkeys.name)}</span>
16+
<span class="label"
17+
>{getDynamicLabel(labelState, commandHotkeys.name)}
18+
19+
{#if HotkeysThatBehaveDifferentlyInOutlineMode.has(commandHotkeys.name)}
20+
<span
21+
class="info-icon"
22+
aria-label="Behaves differently in outline mode"
23+
><Info class="svg-icon" /></span
24+
>
25+
{/if}
26+
</span>
1527
<div class="hotkeys">
1628
{#each commandHotkeys.hotkeys as hotkey, i}
1729
<Hotkey
@@ -32,7 +44,7 @@
3244
border-radius: 4px;
3345
gap: 8px;
3446
background-color: var(--color-base-30);
35-
flex-wrap:wrap;
47+
flex-wrap: wrap;
3648
}
3749
3850
.hotkeys {
@@ -45,6 +57,19 @@
4557
.label {
4658
font-size: 14px;
4759
color: var(--text-normal);
48-
display: block;
60+
position: relative;
61+
display: flex;
62+
align-items: center;
63+
gap: 5px;
64+
}
65+
66+
.info-icon {
67+
color: #4973A1FF;
68+
margin-bottom: -4px;
69+
70+
& svg {
71+
width: 12px;
72+
height: 12px;
73+
}
4974
}
5075
</style>

src/view/components/container/controls-bar/modals/hotkeys/components/helpers/get-dynamic-label.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import { CommandName } from 'src/lang/hotkey-groups';
22
import { hotkeysLang } from 'src/lang/hotkeys-lang';
33
import { lang } from 'src/lang/lang';
44

5+
export const HotkeysThatBehaveDifferentlyInOutlineMode: Set<CommandName> =
6+
new Set(['go_down', 'go_up', 'go_left', 'go_right']);
7+
58
export type DynamicLabelState = { outlineMode: boolean };
69

710
export const getDynamicLabel = (

0 commit comments

Comments
 (0)