Skip to content

Commit c478836

Browse files
committed
Conditionally show shortcut button if only 1 result
1 parent d44c72a commit c478836

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

apps/webapp/app/components/primitives/Buttons.tsx

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -298,19 +298,17 @@ export const Button = forwardRef<HTMLButtonElement, ButtonPropsType>(
298298
const innerRef = useRef<HTMLButtonElement>(null);
299299
useImperativeHandle(ref, () => innerRef.current as HTMLButtonElement);
300300

301-
if (props.shortcut) {
302-
useShortcutKeys({
303-
shortcut: props.shortcut,
304-
action: (e) => {
305-
if (innerRef.current) {
306-
innerRef.current.click();
307-
e.preventDefault();
308-
e.stopPropagation();
309-
}
310-
},
311-
disabled,
312-
});
313-
}
301+
useShortcutKeys({
302+
shortcut: props.shortcut,
303+
action: (e) => {
304+
if (innerRef.current) {
305+
innerRef.current.click();
306+
e.preventDefault();
307+
e.stopPropagation();
308+
}
309+
},
310+
disabled: disabled || !props.shortcut,
311+
});
314312

315313
return (
316314
<button

0 commit comments

Comments
 (0)