mirror of
https://github.com/docmost/docmost.git
synced 2025-11-13 01:22:36 +10:00
* fix tree nodes sort * remove comment mark in shares * remove clickoutside hook for now * feat: search in shared pages * fix user-select * use Link * render page icons
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="default"
|
|
style={{ border: "none" }}
|
|
onClick={onSearch}
|
|
size="sm"
|
|
>
|
|
<IconSearch size={20} stroke={2} />
|
|
</ActionIcon>
|
|
</Tooltip>
|
|
);
|
|
}
|