feat: Enable API search (#353)
* enabled search in ref and changed from section -> main so Algolia will index ref content * fix: algolia apu key
This commit is contained in:
@@ -82,7 +82,7 @@ const Section = ({ data }) => {
|
||||
}, [isInView])
|
||||
|
||||
return (
|
||||
<section
|
||||
<main
|
||||
ref={sectionRef}
|
||||
id={convertToKebabCase(section.section_name)}
|
||||
className="DocSearch-content"
|
||||
@@ -200,7 +200,7 @@ const Section = ({ data }) => {
|
||||
)}
|
||||
</Flex>
|
||||
</Box>
|
||||
</section>
|
||||
</main>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -2,12 +2,10 @@ import React from "react"
|
||||
import { DocSearch } from "@docsearch/react"
|
||||
import "../../medusa-plugin-themes/docsearch/theme.css"
|
||||
|
||||
const algoliaApiKey =
|
||||
process.env.ALGOLIA_API_KEY || "25626fae796133dc1e734c6bcaaeac3c" //second opt is for testing purposes
|
||||
const algoliaIndexName = process.env.ALGOLIA_API_KEY || "docsearch"
|
||||
const algoliaApiKey = process.env.ALGOLIA_API_KEY || "temp"
|
||||
|
||||
const Search = () => {
|
||||
return <DocSearch apiKey={algoliaApiKey} indexName={algoliaIndexName} />
|
||||
return <DocSearch apiKey={algoliaApiKey} indexName="medusa-commerce" />
|
||||
}
|
||||
|
||||
export default Search
|
||||
|
||||
@@ -95,6 +95,9 @@ const Topbar = ({ data, api }) => {
|
||||
<Flex
|
||||
sx={{
|
||||
alignItems: "center",
|
||||
maxWidth: "400px",
|
||||
flexGrow: "1",
|
||||
justifyContent: "flex-end",
|
||||
}}
|
||||
>
|
||||
<Link variant="topbar" mr={3} href="https://docs.medusa-commerce.com">
|
||||
@@ -109,8 +112,7 @@ const Topbar = ({ data, api }) => {
|
||||
>
|
||||
<GitHub />
|
||||
</Link>
|
||||
{/* Re-add once indexing has been fine tuned */}
|
||||
{/* <Search /> */}
|
||||
<Search />
|
||||
</Flex>
|
||||
</Flex>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user