Skip to content

Commit 6023e8c

Browse files
[WEB-6784] feat scrollbar in shortcuts modal (#8872)
* fix: update border for project timezone * feat: added scrollbar in keyboard shortcuts modal * fix: remove unnecessary changes * fix: remove redundant overflow
1 parent 77c4b9c commit 6023e8c

2 files changed

Lines changed: 23 additions & 17 deletions

File tree

apps/web/core/components/power-k/ui/modal/shortcuts-root.tsx

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { useState, Fragment } from "react";
88
import { Dialog, Transition } from "@headlessui/react";
99
// plane imports
1010
import { CloseIcon, SearchIcon } from "@plane/propel/icons";
11+
import { ScrollArea } from "@plane/propel/scrollarea";
1112
import { Input } from "@plane/ui";
1213
// hooks
1314
import { usePowerK } from "@/hooks/store/use-power-k";
@@ -61,28 +62,33 @@ export function ShortcutsModal(props: Props) {
6162
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
6263
>
6364
<Dialog.Panel className="relative flex h-full items-center justify-center">
64-
<div className="flex h-[61vh] w-full flex-col space-y-4 overflow-hidden rounded-lg bg-surface-1 p-5 shadow-raised-200 transition-all sm:w-[28rem]">
65-
<Dialog.Title as="h3" className="flex justify-between">
65+
<div className="flex h-[61vh] w-full flex-col space-y-4 overflow-hidden rounded-lg bg-surface-1 py-5 shadow-raised-200 transition-all sm:w-[28rem]">
66+
<Dialog.Title as="h3" className="flex justify-between px-5">
6667
<span className="text-16 font-medium">Keyboard shortcuts</span>
6768
<button type="button" onClick={handleClose}>
6869
<CloseIcon className="h-4 w-4 text-secondary hover:text-primary" aria-hidden="true" />
6970
</button>
7071
</Dialog.Title>
71-
<div className="flex w-full items-center rounded-sm border-[0.5px] border-subtle bg-surface-2 px-2">
72-
<SearchIcon className="h-3.5 w-3.5 text-secondary" />
73-
<Input
74-
id="search"
75-
name="search"
76-
type="text"
77-
value={query}
78-
onChange={(e) => setQuery(e.target.value)}
79-
placeholder="Search for shortcuts"
80-
className="w-full border-none bg-transparent py-1 text-11 text-secondary outline-none"
81-
autoFocus
82-
tabIndex={1}
83-
/>
72+
<div className="px-5">
73+
<div className="flex w-full items-center rounded-sm border-[0.5px] border-subtle bg-surface-2 px-2">
74+
<SearchIcon className="h-3.5 w-3.5 text-secondary" />
75+
<Input
76+
id="search"
77+
name="search"
78+
type="text"
79+
value={query}
80+
onChange={(e) => setQuery(e.target.value)}
81+
placeholder="Search for shortcuts"
82+
className="w-full border-none bg-transparent py-1 text-11 text-secondary outline-none"
83+
autoFocus
84+
tabIndex={1}
85+
/>
86+
</div>
8487
</div>
85-
<ShortcutRenderer searchQuery={query} commands={allCommandsWithShortcuts} />
88+
89+
<ScrollArea size="sm" rootClassName="overflow-y-scroll px-5">
90+
<ShortcutRenderer searchQuery={query} commands={allCommandsWithShortcuts} />
91+
</ScrollArea>
8692
</div>
8793
</Dialog.Panel>
8894
</Transition.Child>

apps/web/core/components/power-k/ui/renderer/shortcut.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export function ShortcutRenderer(props: Props) {
7878
const isShortcutsEmpty = groupedCommands.length === 0;
7979

8080
return (
81-
<div className="flex flex-col gap-y-3 overflow-y-auto">
81+
<div className="flex flex-col gap-y-3">
8282
{!isShortcutsEmpty ? (
8383
groupedCommands.map((group) => (
8484
<div key={group.key}>

0 commit comments

Comments
 (0)