Skip to content

Commit

Permalink
remove inkeep searchbar
Browse files Browse the repository at this point in the history
  • Loading branch information
ZYJLiu committed Feb 26, 2025
1 parent baeef59 commit e03556d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
10 changes: 5 additions & 5 deletions src/app/components/inkeep-script.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ export function InkeepScript() {
},
},
};
window.Inkeep().embed({
componentType: "SearchBar",
targetElement: "#inkeepSearchBar",
...config,
});
// window.Inkeep().embed({
// componentType: "SearchBar",
// targetElement: "#inkeepSearchBar",
// ...config,
// });
window.Inkeep().embed({
componentType: "ChatButton",
...config,
Expand Down
24 changes: 20 additions & 4 deletions src/components/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
import Navbar from "react-bootstrap/Navbar";
import { useRouter } from "@/hooks/useRouter";
import { Link } from "../utils/Link";
import { useEffect } from "react";
import { useEffect, useState } from "react";
import SolanaLogo from "../../public/src/img/logos-solana/logotype.inline.svg";
import Moon from "../../public/src/img/icons/Moon.inline.svg";
import Sun from "../../public/src/img/icons/Sun.inline.svg";
import HeaderList from "./header/HeaderList";
import { DocSearch } from "@docsearch/react";
import { useTheme } from "@/themecontext";
import { useTranslation } from "react-i18next";
import DevelopersNav from "./developers/DevelopersNav/DevelopersNav";
Expand All @@ -18,6 +19,8 @@ const Header = ({ className = "", containerClassName = "" }) => {
const { theme, toggleTheme, isThemePage } = useTheme();
const { t } = useTranslation();

const [searchText, setSearchText] = useState("Search");

useEffect(() => {
setSearchText(t("commands.search"));

Expand Down Expand Up @@ -59,9 +62,22 @@ const Header = ({ className = "", containerClassName = "" }) => {
<HeaderList />
</Navbar.Collapse>

<div className="ms-3">
<div id="inkeepSearchBar" />
</div>
<DocSearch
// note: these values are safe to be published and are NOT secrets
apiKey={"011e01358301f5023b02da5db6af7f4d"}
appId={"FQ12ISJR4B"}
indexName={"solana-com"}
placeholder={searchText}
searchParameters={{
facetFilters: [`language:${router?.locale || "en"}`],
}}
translations={{
button: {
buttonText: searchText,
buttonAriaLabel: searchText,
},
}}
/>

{isThemePage && (
<button
Expand Down
2 changes: 0 additions & 2 deletions src/components/layout.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import Header from "./Header";
import Footer from "./Footer";
import { InkeepScript } from "../app/components/inkeep-script";

const Layout = ({ children }) => {
return (
<>
<Header />
<main>{children}</main>
<InkeepScript />
<Footer />
</>
);
Expand Down

0 comments on commit e03556d

Please sign in to comment.