mirror of
https://github.com/docmost/docmost.git
synced 2026-05-17 23:14:07 +08:00
05b3c65b0f
* feat: notifications * feat: watchers * improvements * handle page move for watchers * make watchers non-blocking * more
57 lines
1.3 KiB
TypeScript
57 lines
1.3 KiB
TypeScript
import { IconSearch } from "@tabler/icons-react";
|
|
import cx from "clsx";
|
|
import {
|
|
ActionIcon,
|
|
BoxProps,
|
|
ElementProps,
|
|
Group,
|
|
rem,
|
|
Text,
|
|
Tooltip,
|
|
UnstyledButton,
|
|
} from "@mantine/core";
|
|
import classes from "./search-control.module.css";
|
|
import React from "react";
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
interface SearchControlProps extends BoxProps, ElementProps<"button"> {}
|
|
|
|
export function SearchControl({ className, ...others }: SearchControlProps) {
|
|
const { t } = useTranslation();
|
|
|
|
return (
|
|
<UnstyledButton {...others} className={cx(classes.root, className)}>
|
|
<Group gap="xs" wrap="nowrap">
|
|
<IconSearch style={{ width: rem(15), height: rem(15) }} stroke={1.5} />
|
|
<Text fz="sm" c="dimmed" pr={80}>
|
|
{t("Search")}
|
|
</Text>
|
|
<Text fw={700} className={classes.shortcut}>
|
|
Ctrl + K
|
|
</Text>
|
|
</Group>
|
|
</UnstyledButton>
|
|
);
|
|
}
|
|
|
|
interface SearchMobileControlProps {
|
|
onSearch: () => void;
|
|
}
|
|
|
|
export function SearchMobileControl({ onSearch }: SearchMobileControlProps) {
|
|
const { t } = useTranslation();
|
|
|
|
return (
|
|
<Tooltip label={t("Search")} withArrow>
|
|
<ActionIcon
|
|
variant="subtle"
|
|
color="dark"
|
|
onClick={onSearch}
|
|
size="sm"
|
|
>
|
|
<IconSearch size={20} stroke={2} />
|
|
</ActionIcon>
|
|
</Tooltip>
|
|
);
|
|
}
|