mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 12:17:24 +00:00
Initial commit
This commit is contained in:
25
frontend/src/pages/search_page.tsx
Normal file
25
frontend/src/pages/search_page.tsx
Normal file
@@ -0,0 +1,25 @@
|
||||
import {useSearchParams} from "react-router";
|
||||
import {network} from "../network/network.ts";
|
||||
import ResourcesView from "../components/resources_view.tsx";
|
||||
import {useEffect} from "react";
|
||||
import {useTranslation} from "react-i18next";
|
||||
|
||||
export default function SearchPage() {
|
||||
const [params, _] = useSearchParams()
|
||||
const { t } = useTranslation();
|
||||
|
||||
const keyword = params.get("keyword")
|
||||
|
||||
useEffect(() => {}, [])
|
||||
|
||||
if (keyword === null || keyword === "") {
|
||||
return <div role="alert" className="alert alert-info alert-dash">
|
||||
<span>{t("Enter a search keyword to continue")}</span>
|
||||
</div>
|
||||
}
|
||||
|
||||
return <div key={keyword}>
|
||||
<h1 className={"text-2xl px-4 pt-4 font-bold my-2"}>{t("Search")}: {keyword}</h1>
|
||||
<ResourcesView loader={(page) => network.searchResources(keyword, page)}></ResourcesView>
|
||||
</div>
|
||||
}
|
Reference in New Issue
Block a user