Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add searchbar to docs #858

Merged
merged 9 commits into from
Jul 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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