[ci] format
This commit is contained in:
parent
17da2b1611
commit
29e7260a4e
1 changed files with 78 additions and 85 deletions
|
@ -1,21 +1,19 @@
|
|||
/* jsxImportSource: react */
|
||||
import { useState, useCallback, useRef } from "react";
|
||||
import * as CONFIG from "../../config";
|
||||
import "@docsearch/css/dist/style.css";
|
||||
import "./Search.css";
|
||||
import { useState, useCallback, useRef } from 'react';
|
||||
import * as CONFIG from '../../config';
|
||||
import '@docsearch/css/dist/style.css';
|
||||
import './Search.css';
|
||||
|
||||
// @ts-ignore
|
||||
import * as docSearchReact from "@docsearch/react";
|
||||
import * as docSearchReact from '@docsearch/react';
|
||||
// @ts-ignore
|
||||
import { createPortal } from "react-dom";
|
||||
import { createPortal } from 'react-dom';
|
||||
|
||||
export default function Search() {
|
||||
const DocSearchModal =
|
||||
docSearchReact.DocSearchModal || docSearchReact.default.DocSearchModal;
|
||||
const DocSearchModal = docSearchReact.DocSearchModal || docSearchReact.default.DocSearchModal;
|
||||
|
||||
const useDocSearchKeyboardEvents =
|
||||
docSearchReact.useDocSearchKeyboardEvents ||
|
||||
docSearchReact.default.useDocSearchKeyboardEvents;
|
||||
docSearchReact.useDocSearchKeyboardEvents || docSearchReact.default.useDocSearchKeyboardEvents;
|
||||
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const searchButtonRef = useRef();
|
||||
|
@ -47,12 +45,7 @@ export default function Search() {
|
|||
|
||||
return (
|
||||
<>
|
||||
<button
|
||||
type="button"
|
||||
ref={searchButtonRef}
|
||||
onClick={onOpen}
|
||||
className="search-input"
|
||||
>
|
||||
<button type="button" ref={searchButtonRef} onClick={onOpen} className="search-input">
|
||||
<svg width="24" height="24" fill="none">
|
||||
<path
|
||||
d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
|
||||
|
@ -87,9 +80,9 @@ export default function Search() {
|
|||
return items.map((item) => {
|
||||
// We transform the absolute URL into a relative URL to
|
||||
// work better on localhost, preview URLS.
|
||||
const a = document.createElement("a");
|
||||
const a = document.createElement('a');
|
||||
a.href = item.url;
|
||||
const hash = a.hash === "#overview" ? "" : a.hash;
|
||||
const hash = a.hash === '#overview' ? '' : a.hash;
|
||||
return {
|
||||
...item,
|
||||
url: `${a.pathname}${hash}`,
|
||||
|
|
Loading…
Reference in a new issue