Skip to content

Commit

Permalink
Merge pull request #858 from facebookresearch/add-search-to-docs
Browse files Browse the repository at this point in the history
Add searchbar to docs
  • Loading branch information
Etesam913 committed Jul 26, 2022
2 parents 43d40b2 + 4fca82a commit d000d70
Show file tree
Hide file tree
Showing 6 changed files with 1,054 additions and 706 deletions.
11 changes: 11 additions & 0 deletions docs/web/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ const config = {
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
algolia: {
// The application ID provided by Algolia
appId: "J6ARWT70HK",

// Public API key: it is safe to commit it
apiKey: "ac51a5b25842fad8a3a7b1f384496bf9",

indexName: "mephisto",
contextualSearch: false,
searchPagePath: false,
},
navbar: {
// title: "Mephisto",
logo: {
Expand Down
2 changes: 2 additions & 0 deletions docs/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"write-heading-ids": "docusaurus write-heading-ids"
},
"dependencies": {
"@docsearch/css": "3",
"@docsearch/react": "3",
"@docusaurus/core": "2.0.0-beta.9",
"@docusaurus/preset-classic": "2.0.0-beta.9",
"@mdx-js/react": "^1.6.21",
Expand Down
19 changes: 19 additions & 0 deletions docs/web/src/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,22 @@ h6 {
font-weight: bold;
font-style: normal;
}
.DocSearch-Modal {
margin: 80px auto auto !important;
}

@media (max-width: 750px) {
.DocSearch-Modal {
margin: 60px 0 !important;
}
}

/*
This hides the text that allows you to see all results
As of now when you try to see all results it takes you to a separate page
This page has a searchbar, but no options show.
That is why it is being hidden.
*/
.DocSearch-HitsFooter {
display: none !important;
}
4 changes: 3 additions & 1 deletion docs/web/src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import Link from "@docusaurus/Link";
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
import styles from "./index.module.css";
import HomepageFeatures from "../components/HomepageFeatures";
import { DocSearch } from "@docsearch/react";
import "@docsearch/css";

function HomepageHeader() {
const { siteConfig } = useDocusaurusContext();
Expand Down Expand Up @@ -33,11 +35,11 @@ function HomepageHeader() {
Github
</Link>
</div>
<div className={styles.searchBarContainer}></div>
</div>
</header>
);
}

export default function Home() {
const { siteConfig } = useDocusaurusContext();
return (
Expand Down
6 changes: 6 additions & 0 deletions docs/web/src/pages/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,9 @@ html[data-theme="dark"] .heroBanner {
background-color: var(--ifm-background-surface-color);
color: white;
}

.searchBarContainer {
display: flex;
justify-content: center;
margin-top: 1.5rem;
}
Loading

0 comments on commit d000d70

Please sign in to comment.