mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-02 19:01:40 +00:00
Add handlers to open command palette
This commit is contained in:
parent
822060b82c
commit
c85a7079eb
3 changed files with 33 additions and 5 deletions
|
|
@ -1,10 +1,11 @@
|
|||
import { Grid, Group, TextInput } from '@mantine/core';
|
||||
import { Grid, Group } from '@mantine/core';
|
||||
import { RiSearchLine, RiMenuFill, RiArrowLeftSLine, RiArrowRightSLine } from 'react-icons/ri';
|
||||
import { useNavigate } from 'react-router';
|
||||
import styled from 'styled-components';
|
||||
import { Button, DropdownMenu } from '/@/renderer/components';
|
||||
import { Button, DropdownMenu, TextInput } from '/@/renderer/components';
|
||||
import { AppMenu } from '/@/renderer/features/titlebar/components/app-menu';
|
||||
import { useContainerQuery } from '/@/renderer/hooks';
|
||||
import { useCommandPalette } from '/@/renderer/store';
|
||||
|
||||
const ActionsContainer = styled(Grid)`
|
||||
display: flex;
|
||||
|
|
@ -21,6 +22,7 @@ const ActionsContainer = styled(Grid)`
|
|||
export const ActionBar = () => {
|
||||
const cq = useContainerQuery({ sm: 300 });
|
||||
const navigate = useNavigate();
|
||||
const { open } = useCommandPalette();
|
||||
|
||||
return (
|
||||
<ActionsContainer
|
||||
|
|
@ -29,11 +31,16 @@ export const ActionBar = () => {
|
|||
>
|
||||
<Grid.Col span={cq.isSm ? 7 : 6}>
|
||||
<TextInput
|
||||
disabled
|
||||
readOnly
|
||||
icon={<RiSearchLine />}
|
||||
placeholder="Search"
|
||||
size="md"
|
||||
onClick={open}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter' || e.key === ' ') {
|
||||
open();
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={cq.isSm ? 5 : 6}>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue