mirror of
https://github.com/jeffvli/feishin.git
synced 2026-07-06 18:49:59 +02:00
69 lines
2.5 KiB
TypeScript
69 lines
2.5 KiB
TypeScript
import { useTranslation } from 'react-i18next';
|
|
import { useNavigate } from 'react-router';
|
|
|
|
import styles from './action-bar.module.css';
|
|
|
|
import { AppMenu } from '/@/renderer/features/titlebar/components/app-menu';
|
|
import { useCommandPalette } from '/@/renderer/store';
|
|
import { Button } from '/@/shared/components/button/button';
|
|
import { DropdownMenu } from '/@/shared/components/dropdown-menu/dropdown-menu';
|
|
import { Grid } from '/@/shared/components/grid/grid';
|
|
import { Group } from '/@/shared/components/group/group';
|
|
import { Icon } from '/@/shared/components/icon/icon';
|
|
import { TextInput } from '/@/shared/components/text-input/text-input';
|
|
|
|
export const ActionBar = () => {
|
|
const { t } = useTranslation();
|
|
const { open } = useCommandPalette();
|
|
|
|
return (
|
|
<div className={styles.container}>
|
|
<Grid display="flex" gap="sm" style={{ padding: '0 var(--theme-spacing-md)' }} w="100%">
|
|
<Grid.Col span={7}>
|
|
<TextInput
|
|
leftSection={<Icon icon="search" />}
|
|
onClick={open}
|
|
onKeyDown={(e) => {
|
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
open();
|
|
}
|
|
}}
|
|
placeholder={t('common.search')}
|
|
readOnly
|
|
/>
|
|
</Grid.Col>
|
|
<Grid.Col span={5}>
|
|
<Group gap="sm" grow wrap="nowrap">
|
|
<DropdownMenu position="bottom-start">
|
|
<DropdownMenu.Target>
|
|
<Button p="0">
|
|
<Icon icon="menu" size="lg" />
|
|
</Button>
|
|
</DropdownMenu.Target>
|
|
<DropdownMenu.Dropdown>
|
|
<AppMenu />
|
|
</DropdownMenu.Dropdown>
|
|
</DropdownMenu>
|
|
<NavigateButtons />
|
|
</Group>
|
|
</Grid.Col>
|
|
</Grid>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
const NavigateButtons = () => {
|
|
const navigate = useNavigate();
|
|
|
|
return (
|
|
<>
|
|
<Button onClick={() => navigate(-1)} p="0">
|
|
<Icon icon="arrowLeftS" size="lg" />
|
|
</Button>
|
|
<Button onClick={() => navigate(1)} p="0">
|
|
<Icon icon="arrowRightS" size="lg" />
|
|
</Button>
|
|
</>
|
|
);
|
|
};
|