mirror of
https://github.com/docmost/docmost.git
synced 2026-07-26 01:35:11 +10:00
use Link
This commit is contained in:
@@ -2,7 +2,7 @@ import { Group, Center, Text } from "@mantine/core";
|
|||||||
import { Spotlight } from "@mantine/spotlight";
|
import { Spotlight } from "@mantine/spotlight";
|
||||||
import { IconSearch } from "@tabler/icons-react";
|
import { IconSearch } from "@tabler/icons-react";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { useDebouncedValue } from "@mantine/hooks";
|
import { useDebouncedValue } from "@mantine/hooks";
|
||||||
import { usePageSearchQuery } from "@/features/search/queries/search-query";
|
import { usePageSearchQuery } from "@/features/search/queries/search-query";
|
||||||
import { buildPageUrl } from "@/features/page/page.utils.ts";
|
import { buildPageUrl } from "@/features/page/page.utils.ts";
|
||||||
@@ -15,7 +15,6 @@ interface SearchSpotlightProps {
|
|||||||
}
|
}
|
||||||
export function SearchSpotlight({ spaceId }: SearchSpotlightProps) {
|
export function SearchSpotlight({ spaceId }: SearchSpotlightProps) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const navigate = useNavigate();
|
|
||||||
const [query, setQuery] = useState("");
|
const [query, setQuery] = useState("");
|
||||||
const [debouncedSearchQuery] = useDebouncedValue(query, 300);
|
const [debouncedSearchQuery] = useDebouncedValue(query, 300);
|
||||||
|
|
||||||
@@ -29,9 +28,10 @@ export function SearchSpotlight({ spaceId }: SearchSpotlightProps) {
|
|||||||
).map((page) => (
|
).map((page) => (
|
||||||
<Spotlight.Action
|
<Spotlight.Action
|
||||||
key={page.id}
|
key={page.id}
|
||||||
onClick={() =>
|
component={Link}
|
||||||
navigate(buildPageUrl(page.space.slug, page.slugId, page.title))
|
//@ts-ignore
|
||||||
}
|
to={buildPageUrl(page.space.slug, page.slugId, page.title)}
|
||||||
|
style={{ userSelect: "none" }}
|
||||||
>
|
>
|
||||||
<Group wrap="nowrap" w="100%">
|
<Group wrap="nowrap" w="100%">
|
||||||
<Center>{getPageIcon(page?.icon)}</Center>
|
<Center>{getPageIcon(page?.icon)}</Center>
|
||||||
|
|||||||
Reference in New Issue
Block a user