mirror of
https://github.com/urbit/developers.urbit.org.git
synced 2024-08-18 02:00:37 +03:00
fix search
This commit is contained in:
parent
c7226d512e
commit
481795ed15
@ -2,6 +2,8 @@ import { useState, useEffect, useRef } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { TableOfContents } from "@urbit/foundation-design-system";
|
import { TableOfContents } from "@urbit/foundation-design-system";
|
||||||
|
|
||||||
|
import { DocSearch } from '@docsearch/react';
|
||||||
|
|
||||||
export default function ContentArea(props) {
|
export default function ContentArea(props) {
|
||||||
const [shortcut, setShortcut] = useState("");
|
const [shortcut, setShortcut] = useState("");
|
||||||
|
|
||||||
@ -50,15 +52,11 @@ export default function ContentArea(props) {
|
|||||||
{props.breadcrumbs}
|
{props.breadcrumbs}
|
||||||
</div>
|
</div>
|
||||||
<div className="hidden md:block">
|
<div className="hidden md:block">
|
||||||
<button
|
<DocSearch
|
||||||
onClick={(e) => {
|
appId="3EVOAL3MOI"
|
||||||
e.stopPropagation();
|
apiKey="00ccef825c17a672ef1c1a9bea3a9903"
|
||||||
props.search.toggleSearch();
|
indexName="developers-urbit"
|
||||||
}}
|
/>
|
||||||
className="bg-wall-100 text-wall-500 flex px-3 py-2 rounded-lg font-semibold text-lg"
|
|
||||||
>
|
|
||||||
Search<div className="ml-4 text-wall-400">{shortcut}</div>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { useState } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import classnames from "classnames";
|
import classnames from "classnames";
|
||||||
import { IntraNav, capitalize, MenuTray } from "@urbit/foundation-design-system";
|
import { IntraNav, capitalize, MenuTray } from "@urbit/foundation-design-system";
|
||||||
|
|
||||||
|
import '@docsearch/css';
|
||||||
|
|
||||||
function ActiveLink({ children, href, className, currentPath }) {
|
function ActiveLink({ children, href, className, currentPath }) {
|
||||||
const firstCrumb = currentPath.split("/")[1];
|
const firstCrumb = currentPath.split("/")[1];
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ export default function Meta(post, disableImage, large = false) {
|
|||||||
href="/images/favicon-16x16.png"
|
href="/images/favicon-16x16.png"
|
||||||
/>
|
/>
|
||||||
<link rel="manifest" href="/images/site.webmanifest" />
|
<link rel="manifest" href="/images/site.webmanifest" />
|
||||||
|
<link rel="preconnect" href="https://3EVOAL3MOI-dsn.algolia.net" crossorigin />
|
||||||
|
|
||||||
<meta
|
<meta
|
||||||
name="twitter:card"
|
name="twitter:card"
|
||||||
|
2365
package-lock.json
generated
2365
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -19,11 +19,12 @@
|
|||||||
"lint": "next lint"
|
"lint": "next lint"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@docsearch/react": "^3.5.2",
|
||||||
"@iarna/toml": "^2.2.5",
|
"@iarna/toml": "^2.2.5",
|
||||||
"@socialgouv/matomo-next": "^1.4.0",
|
"@socialgouv/matomo-next": "^1.4.0",
|
||||||
"@tailwindcss/aspect-ratio": "^0.4.0",
|
"@tailwindcss/aspect-ratio": "^0.4.0",
|
||||||
"@tlon/sigil-js": "^1.4.5",
|
"@tlon/sigil-js": "^1.4.5",
|
||||||
"@urbit/foundation-design-system": "0.7.5",
|
"@urbit/foundation-design-system": "urbit/foundation-design-system#74572cd4a5cd7e29c99419672fdc8f709617f063",
|
||||||
"@urbit/markdoc": "^0.1.6",
|
"@urbit/markdoc": "^0.1.6",
|
||||||
"axios": "^0.26.1",
|
"axios": "^0.26.1",
|
||||||
"buffer": "^6.0.3",
|
"buffer": "^6.0.3",
|
||||||
|
@ -51,9 +51,9 @@ function MyApp({ Component, pageProps }) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handlers = {
|
const handlers = {
|
||||||
closeSearch: (event) => closeSearch(event),
|
// closeSearch: (event) => closeSearch(event),
|
||||||
openSearch: (event) => openSearch(event),
|
// openSearch: (event) => openSearch(event),
|
||||||
toggleSearch: (event) => toggleSearch(event),
|
// toggleSearch: (event) => toggleSearch(event),
|
||||||
};
|
};
|
||||||
|
|
||||||
configure({
|
configure({
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Html, Head, Main, NextScript } from 'next/document'
|
import { Html, Head, Main, NextScript } from 'next/document';
|
||||||
import Script from 'next/script';
|
import Script from 'next/script';
|
||||||
|
|
||||||
export default function Document() {
|
export default function Document() {
|
||||||
@ -28,6 +28,13 @@ export default function Document() {
|
|||||||
startup: {
|
startup: {
|
||||||
typeset: false,
|
typeset: false,
|
||||||
ready: () => {
|
ready: () => {
|
||||||
|
// setting data-theme so that @docsearch/react understands
|
||||||
|
// whether it should be in dark mode or not
|
||||||
|
if (window.matchMedia) {
|
||||||
|
if (window.matchMedia("(prefers-color-scheme: dark)").matches) {
|
||||||
|
document.querySelector("html").setAttribute("data-theme", "dark");
|
||||||
|
}
|
||||||
|
}
|
||||||
MathJax.startup.defaultReady();
|
MathJax.startup.defaultReady();
|
||||||
window.__MathJax_State__.isReady = true;
|
window.__MathJax_State__.isReady = true;
|
||||||
resolve();
|
resolve();
|
||||||
|
Loading…
Reference in New Issue
Block a user