Restore Algolia DocSearch

This commit is contained in:
mDuo13
2024-12-05 18:10:38 -08:00
parent bda6ae7cf0
commit 012aefec29
8 changed files with 411 additions and 57 deletions

View File

@@ -0,0 +1,14 @@
import { DocSearch } from '@docsearch/react';
export function AlgoliaSearch() {
return (
<DocSearch
appId="R39QY3MZC7"
indexName="xrpl"
apiKey="3431349deec23b0bc3dcd3424beb9a6e"
searchParameters={{
facetFilters: ['lang:en'],
}}
/>
)
}

View File

@@ -5,7 +5,7 @@ import { LanguagePicker } from "@redocly/theme/components/LanguagePicker/Languag
import { slugify } from "../../helpers";
import { Link } from "@redocly/theme/components/Link/Link";
import { ColorModeSwitcher } from "@redocly/theme/components/ColorModeSwitcher/ColorModeSwitcher";
import { Search } from "@redocly/theme/components/Search/Search";
import { AlgoliaSearch } from "./AlgoliaSearch";
// @ts-ignore
@@ -101,7 +101,7 @@ export function Navbar(props) {
<NavItems>
{navItems}
<div id="topnav-search" className="nav-item search">
<Search className="topnav-search" />
<AlgoliaSearch />
</div>
<div id="topnav-language" className="nav-item">
<LanguagePicker

313
package-lock.json generated
View File

@@ -11,6 +11,7 @@
"dependencies": {
"@codemirror/state": "6.4.1",
"@codemirror/view": "^6.22.2",
"@docsearch/react": "^3.8.0",
"@lezer/highlight": "^1.2.0",
"@redocly/realm": "0.103.1",
"@uiw/codemirror-themes": "4.21.21",
@@ -34,6 +35,231 @@
"sass": "1.26.10"
}
},
"node_modules/@algolia/autocomplete-core": {
"version": "1.17.7",
"resolved": "https://registry.npmjs.org/@algolia/autocomplete-core/-/autocomplete-core-1.17.7.tgz",
"integrity": "sha512-BjiPOW6ks90UKl7TwMv7oNQMnzU+t/wk9mgIDi6b1tXpUek7MW0lbNOUHpvam9pe3lVCf4xPFT+lK7s+e+fs7Q==",
"license": "MIT",
"dependencies": {
"@algolia/autocomplete-plugin-algolia-insights": "1.17.7",
"@algolia/autocomplete-shared": "1.17.7"
}
},
"node_modules/@algolia/autocomplete-plugin-algolia-insights": {
"version": "1.17.7",
"resolved": "https://registry.npmjs.org/@algolia/autocomplete-plugin-algolia-insights/-/autocomplete-plugin-algolia-insights-1.17.7.tgz",
"integrity": "sha512-Jca5Ude6yUOuyzjnz57og7Et3aXjbwCSDf/8onLHSQgw1qW3ALl9mrMWaXb5FmPVkV3EtkD2F/+NkT6VHyPu9A==",
"license": "MIT",
"dependencies": {
"@algolia/autocomplete-shared": "1.17.7"
},
"peerDependencies": {
"search-insights": ">= 1 < 3"
}
},
"node_modules/@algolia/autocomplete-preset-algolia": {
"version": "1.17.7",
"resolved": "https://registry.npmjs.org/@algolia/autocomplete-preset-algolia/-/autocomplete-preset-algolia-1.17.7.tgz",
"integrity": "sha512-ggOQ950+nwbWROq2MOCIL71RE0DdQZsceqrg32UqnhDz8FlO9rL8ONHNsI2R1MH0tkgVIDKI/D0sMiUchsFdWA==",
"license": "MIT",
"dependencies": {
"@algolia/autocomplete-shared": "1.17.7"
},
"peerDependencies": {
"@algolia/client-search": ">= 4.9.1 < 6",
"algoliasearch": ">= 4.9.1 < 6"
}
},
"node_modules/@algolia/autocomplete-shared": {
"version": "1.17.7",
"resolved": "https://registry.npmjs.org/@algolia/autocomplete-shared/-/autocomplete-shared-1.17.7.tgz",
"integrity": "sha512-o/1Vurr42U/qskRSuhBH+VKxMvkkUVTLU6WZQr+L5lGZZLYWyhdzWjW0iGXY7EkwRTjBqvN2EsR81yCTGV/kmg==",
"license": "MIT",
"peerDependencies": {
"@algolia/client-search": ">= 4.9.1 < 6",
"algoliasearch": ">= 4.9.1 < 6"
}
},
"node_modules/@algolia/client-abtesting": {
"version": "5.15.0",
"resolved": "https://registry.npmjs.org/@algolia/client-abtesting/-/client-abtesting-5.15.0.tgz",
"integrity": "sha512-FaEM40iuiv1mAipYyiptP4EyxkJ8qHfowCpEeusdHUC4C7spATJYArD2rX3AxkVeREkDIgYEOuXcwKUbDCr7Nw==",
"license": "MIT",
"dependencies": {
"@algolia/client-common": "5.15.0",
"@algolia/requester-browser-xhr": "5.15.0",
"@algolia/requester-fetch": "5.15.0",
"@algolia/requester-node-http": "5.15.0"
},
"engines": {
"node": ">= 14.0.0"
}
},
"node_modules/@algolia/client-analytics": {
"version": "5.15.0",
"resolved": "https://registry.npmjs.org/@algolia/client-analytics/-/client-analytics-5.15.0.tgz",
"integrity": "sha512-lho0gTFsQDIdCwyUKTtMuf9nCLwq9jOGlLGIeQGKDxXF7HbiAysFIu5QW/iQr1LzMgDyM9NH7K98KY+BiIFriQ==",
"license": "MIT",
"dependencies": {
"@algolia/client-common": "5.15.0",
"@algolia/requester-browser-xhr": "5.15.0",
"@algolia/requester-fetch": "5.15.0",
"@algolia/requester-node-http": "5.15.0"
},
"engines": {
"node": ">= 14.0.0"
}
},
"node_modules/@algolia/client-common": {
"version": "5.15.0",
"resolved": "https://registry.npmjs.org/@algolia/client-common/-/client-common-5.15.0.tgz",
"integrity": "sha512-IofrVh213VLsDkPoSKMeM9Dshrv28jhDlBDLRcVJQvlL8pzue7PEB1EZ4UoJFYS3NSn7JOcJ/V+olRQzXlJj1w==",
"license": "MIT",
"engines": {
"node": ">= 14.0.0"
}
},
"node_modules/@algolia/client-insights": {
"version": "5.15.0",
"resolved": "https://registry.npmjs.org/@algolia/client-insights/-/client-insights-5.15.0.tgz",
"integrity": "sha512-bDDEQGfFidDi0UQUCbxXOCdphbVAgbVmxvaV75cypBTQkJ+ABx/Npw7LkFGw1FsoVrttlrrQbwjvUB6mLVKs/w==",
"license": "MIT",
"dependencies": {
"@algolia/client-common": "5.15.0",
"@algolia/requester-browser-xhr": "5.15.0",
"@algolia/requester-fetch": "5.15.0",
"@algolia/requester-node-http": "5.15.0"
},
"engines": {
"node": ">= 14.0.0"
}
},
"node_modules/@algolia/client-personalization": {
"version": "5.15.0",
"resolved": "https://registry.npmjs.org/@algolia/client-personalization/-/client-personalization-5.15.0.tgz",
"integrity": "sha512-LfaZqLUWxdYFq44QrasCDED5bSYOswpQjSiIL7Q5fYlefAAUO95PzBPKCfUhSwhb4rKxigHfDkd81AvEicIEoA==",
"license": "MIT",
"dependencies": {
"@algolia/client-common": "5.15.0",
"@algolia/requester-browser-xhr": "5.15.0",
"@algolia/requester-fetch": "5.15.0",
"@algolia/requester-node-http": "5.15.0"
},
"engines": {
"node": ">= 14.0.0"
}
},
"node_modules/@algolia/client-query-suggestions": {
"version": "5.15.0",
"resolved": "https://registry.npmjs.org/@algolia/client-query-suggestions/-/client-query-suggestions-5.15.0.tgz",
"integrity": "sha512-wu8GVluiZ5+il8WIRsGKu8VxMK9dAlr225h878GGtpTL6VBvwyJvAyLdZsfFIpY0iN++jiNb31q2C1PlPL+n/A==",
"license": "MIT",
"dependencies": {
"@algolia/client-common": "5.15.0",
"@algolia/requester-browser-xhr": "5.15.0",
"@algolia/requester-fetch": "5.15.0",
"@algolia/requester-node-http": "5.15.0"
},
"engines": {
"node": ">= 14.0.0"
}
},
"node_modules/@algolia/client-search": {
"version": "5.15.0",
"resolved": "https://registry.npmjs.org/@algolia/client-search/-/client-search-5.15.0.tgz",
"integrity": "sha512-Z32gEMrRRpEta5UqVQA612sLdoqY3AovvUPClDfMxYrbdDAebmGDVPtSogUba1FZ4pP5dx20D3OV3reogLKsRA==",
"license": "MIT",
"dependencies": {
"@algolia/client-common": "5.15.0",
"@algolia/requester-browser-xhr": "5.15.0",
"@algolia/requester-fetch": "5.15.0",
"@algolia/requester-node-http": "5.15.0"
},
"engines": {
"node": ">= 14.0.0"
}
},
"node_modules/@algolia/ingestion": {
"version": "1.15.0",
"resolved": "https://registry.npmjs.org/@algolia/ingestion/-/ingestion-1.15.0.tgz",
"integrity": "sha512-MkqkAxBQxtQ5if/EX2IPqFA7LothghVyvPoRNA/meS2AW2qkHwcxjuiBxv4H6mnAVEPfJlhu9rkdVz9LgCBgJg==",
"license": "MIT",
"dependencies": {
"@algolia/client-common": "5.15.0",
"@algolia/requester-browser-xhr": "5.15.0",
"@algolia/requester-fetch": "5.15.0",
"@algolia/requester-node-http": "5.15.0"
},
"engines": {
"node": ">= 14.0.0"
}
},
"node_modules/@algolia/monitoring": {
"version": "1.15.0",
"resolved": "https://registry.npmjs.org/@algolia/monitoring/-/monitoring-1.15.0.tgz",
"integrity": "sha512-QPrFnnGLMMdRa8t/4bs7XilPYnoUXDY8PMQJ1sf9ZFwhUysYYhQNX34/enoO0LBjpoOY6rLpha39YQEFbzgKyQ==",
"license": "MIT",
"dependencies": {
"@algolia/client-common": "5.15.0",
"@algolia/requester-browser-xhr": "5.15.0",
"@algolia/requester-fetch": "5.15.0",
"@algolia/requester-node-http": "5.15.0"
},
"engines": {
"node": ">= 14.0.0"
}
},
"node_modules/@algolia/recommend": {
"version": "5.15.0",
"resolved": "https://registry.npmjs.org/@algolia/recommend/-/recommend-5.15.0.tgz",
"integrity": "sha512-5eupMwSqMLDObgSMF0XG958zR6GJP3f7jHDQ3/WlzCM9/YIJiWIUoJFGsko9GYsA5xbLDHE/PhWtq4chcCdaGQ==",
"license": "MIT",
"dependencies": {
"@algolia/client-common": "5.15.0",
"@algolia/requester-browser-xhr": "5.15.0",
"@algolia/requester-fetch": "5.15.0",
"@algolia/requester-node-http": "5.15.0"
},
"engines": {
"node": ">= 14.0.0"
}
},
"node_modules/@algolia/requester-browser-xhr": {
"version": "5.15.0",
"resolved": "https://registry.npmjs.org/@algolia/requester-browser-xhr/-/requester-browser-xhr-5.15.0.tgz",
"integrity": "sha512-Po/GNib6QKruC3XE+WKP1HwVSfCDaZcXu48kD+gwmtDlqHWKc7Bq9lrS0sNZ456rfCKhXksOmMfUs4wRM/Y96w==",
"license": "MIT",
"dependencies": {
"@algolia/client-common": "5.15.0"
},
"engines": {
"node": ">= 14.0.0"
}
},
"node_modules/@algolia/requester-fetch": {
"version": "5.15.0",
"resolved": "https://registry.npmjs.org/@algolia/requester-fetch/-/requester-fetch-5.15.0.tgz",
"integrity": "sha512-rOZ+c0P7ajmccAvpeeNrUmEKoliYFL8aOR5qGW5pFq3oj3Iept7Y5mEtEsOBYsRt6qLnaXn4zUKf+N8nvJpcIw==",
"license": "MIT",
"dependencies": {
"@algolia/client-common": "5.15.0"
},
"engines": {
"node": ">= 14.0.0"
}
},
"node_modules/@algolia/requester-node-http": {
"version": "5.15.0",
"resolved": "https://registry.npmjs.org/@algolia/requester-node-http/-/requester-node-http-5.15.0.tgz",
"integrity": "sha512-b1jTpbFf9LnQHEJP5ddDJKE2sAlhYd7EVSOWgzo/27n/SfCoHfqD0VWntnWYD83PnOKvfe8auZ2+xCb0TXotrQ==",
"license": "MIT",
"dependencies": {
"@algolia/client-common": "5.15.0"
},
"engines": {
"node": ">= 14.0.0"
}
},
"node_modules/@ampproject/remapping": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz",
@@ -534,6 +760,44 @@
"@jridgewell/sourcemap-codec": "^1.4.10"
}
},
"node_modules/@docsearch/css": {
"version": "3.8.0",
"resolved": "https://registry.npmjs.org/@docsearch/css/-/css-3.8.0.tgz",
"integrity": "sha512-pieeipSOW4sQ0+bE5UFC51AOZp9NGxg89wAlZ1BAQFaiRAGK1IKUaPQ0UGZeNctJXyqZ1UvBtOQh2HH+U5GtmA==",
"license": "MIT"
},
"node_modules/@docsearch/react": {
"version": "3.8.0",
"resolved": "https://registry.npmjs.org/@docsearch/react/-/react-3.8.0.tgz",
"integrity": "sha512-WnFK720+iwTVt94CxY3u+FgX6exb3BfN5kE9xUY6uuAH/9W/UFboBZFLlrw/zxFRHoHZCOXRtOylsXF+6LHI+Q==",
"license": "MIT",
"dependencies": {
"@algolia/autocomplete-core": "1.17.7",
"@algolia/autocomplete-preset-algolia": "1.17.7",
"@docsearch/css": "3.8.0",
"algoliasearch": "^5.12.0"
},
"peerDependencies": {
"@types/react": ">= 16.8.0 < 19.0.0",
"react": ">= 16.8.0 < 19.0.0",
"react-dom": ">= 16.8.0 < 19.0.0",
"search-insights": ">= 1 < 3"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"react": {
"optional": true
},
"react-dom": {
"optional": true
},
"search-insights": {
"optional": true
}
}
},
"node_modules/@emotion/babel-plugin": {
"version": "11.12.0",
"resolved": "https://registry.npmjs.org/@emotion/babel-plugin/-/babel-plugin-11.12.0.tgz",
@@ -1601,6 +1865,24 @@
"semver": "bin/semver.js"
}
},
"node_modules/@redocly/realm/node_modules/node-fetch": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.1.tgz",
"integrity": "sha512-cRVc/kyto/7E5shrWca1Wsea4y6tL9iYJE5FBCius3JQfb/4P4I295PfhgbJQBLTx6lATE4z+wK0rPM4VS2uow==",
"license": "MIT",
"dependencies": {
"data-uri-to-buffer": "^4.0.0",
"fetch-blob": "^3.1.4",
"formdata-polyfill": "^4.0.10"
},
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/node-fetch"
}
},
"node_modules/@redocly/replay": {
"version": "0.5.18",
"resolved": "https://registry.npmjs.org/@redocly/replay/-/replay-0.5.18.tgz",
@@ -2272,6 +2554,30 @@
}
}
},
"node_modules/algoliasearch": {
"version": "5.15.0",
"resolved": "https://registry.npmjs.org/algoliasearch/-/algoliasearch-5.15.0.tgz",
"integrity": "sha512-Yf3Swz1s63hjvBVZ/9f2P1Uu48GjmjCN+Esxb6MAONMGtZB1fRX8/S1AhUTtsuTlcGovbYLxpHgc7wEzstDZBw==",
"license": "MIT",
"dependencies": {
"@algolia/client-abtesting": "5.15.0",
"@algolia/client-analytics": "5.15.0",
"@algolia/client-common": "5.15.0",
"@algolia/client-insights": "5.15.0",
"@algolia/client-personalization": "5.15.0",
"@algolia/client-query-suggestions": "5.15.0",
"@algolia/client-search": "5.15.0",
"@algolia/ingestion": "1.15.0",
"@algolia/monitoring": "1.15.0",
"@algolia/recommend": "5.15.0",
"@algolia/requester-browser-xhr": "5.15.0",
"@algolia/requester-fetch": "5.15.0",
"@algolia/requester-node-http": "5.15.0"
},
"engines": {
"node": ">= 14.0.0"
}
},
"node_modules/anser": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/anser/-/anser-2.1.1.tgz",
@@ -5832,6 +6138,13 @@
"loose-envify": "^1.1.0"
}
},
"node_modules/search-insights": {
"version": "2.17.3",
"resolved": "https://registry.npmjs.org/search-insights/-/search-insights-2.17.3.tgz",
"integrity": "sha512-RQPdCYTa8A68uM2jwxoY842xDhvx3E5LFL1LxvxCNMev4o5mLuokczhzjAgGwUZBAmOKZknArSxLKmXtIi2AxQ==",
"license": "MIT",
"peer": true
},
"node_modules/section-matter": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/section-matter/-/section-matter-1.0.0.tgz",

View File

@@ -14,6 +14,7 @@
"dependencies": {
"@codemirror/state": "6.4.1",
"@codemirror/view": "^6.22.2",
"@docsearch/react": "^3.8.0",
"@lezer/highlight": "^1.2.0",
"@redocly/realm": "0.103.1",
"@uiw/codemirror-themes": "4.21.21",

View File

@@ -50,6 +50,8 @@ links:
rel: stylesheet
- href: https://www.unpkg.com/@xrpl/ai-css/xrplai.css
rel: stylesheet
- href: https://cdn.jsdelivr.net/npm/@docsearch/css@3
rel: stylesheet
logo:
srcSet: ./static/img/XRPLedger_DevPortal-black.svg light ./static/img/XRPLedger_DevPortal-white.svg dark

File diff suppressed because one or more lines are too long

View File

@@ -30,14 +30,73 @@
z-index: 1100 !important;
}
.xrp-ledger-dev-portal {
// Algolia Search results --------------------------------------------------
html {
// The extra specificity makes this override the default Algolia styles.
// Algolia Search results --------------------------------------------------
.DocSearch-Modal {
top: 85px;
background-color: #232325;
box-shadow: none;
}
.DocSearch-Button {
height: 32px;
border-radius: 4px;
}
.DocSearch-Button:hover {
border-radius: 4px;
}
.DocSearch-Modal {
max-width: 55%;
margin-right: 13.5em;
}
@include media-breakpoint-down(md) {
.algolia-autocomplete .ds-dropdown-menu {
min-width: unset;
}
.DocSearch-Modal {
top: 112px;
max-width: 100%;
margin-left: 0;
margin-right: 0;
}
}
.DocSearch-Container {
z-index: 99999 !important;
background-color: transparent !important;
}
#centersearchboxcontainer {
justify-content: center;
}
#topsearchboxcontainer {
justify-content: right;
}
.algolia-autocomplete .ds-dropdown-menu [class^="ds-dataset-"] {
background-color: $dropdown-bg;
border: 0;
border-radius: $border-radius-lg;
}
.algolia-autocomplete .algolia-docsearch-suggestion--category-header {
border: 0;
font-weight: bold;
}
.algolia-autocomplete .algolia-docsearch-suggestion--text {
font-size: 0.8rem;
}
.algolia-autocomplete .ds-dropdown-menu::before {
border: 0;
}
}
.dark {
// Fixes for Algolia search interface for dark mode specifically
.DocSearch-Modal {
background-color: #232325;
}
.DocSearch-Cancel {
color: $blue-purple-400;
}
.DocSearch-Form {
box-shadow: inset 0 0 0 2px $blue-purple-400;
background-color: #232325;
@@ -69,7 +128,6 @@
.DocSearch-Help {
color: $black-10 !important;
}
.DocSearch-Hit[aria-selected="true"] a {
background: $gray-700;
.DocSearch-Hit-Container {
@@ -84,11 +142,9 @@
}
.DocSearch-Button {
background: $gray-800;
width: 100%;
}
.DocSearch-Button:hover {
background: $gray-800;
border-radius: 40px;
box-shadow: inset 0 0 0 2px $blue-purple-400;
.DocSearch-Button-Placeholder {
color: $white;
@@ -97,27 +153,6 @@
.DocSearch-Search-Icon {
color: $white !important;
}
.DocSearch-Modal {
margin-top: -20px;
max-width: 55%;
margin-right: 13.5em;
}
@include media-breakpoint-down(md) {
.algolia-autocomplete .ds-dropdown-menu {
min-width: unset;
}
.DocSearch-Modal {
top: 127px;
max-width: 100%;
margin-left: 10px;
margin-right: 20px;
}
}
.DocSearch-Container {
z-index: 99999 !important;
background-color: transparent !important;
}
.DocSearch-Logo svg {
.cls-1,
.cls-2 {
@@ -128,29 +163,9 @@
color: $gray-800;
}
#centersearchboxcontainer {
justify-content: center;
}
#topsearchboxcontainer {
justify-content: right;
}
.algolia-autocomplete .ds-dropdown-menu [class^="ds-dataset-"] {
background-color: $dropdown-bg;
border: 0;
border-radius: $border-radius-lg;
}
.algolia-autocomplete .ds-dropdown-menu::before {
background-color: $dropdown-bg;
border: 0;
}
.algolia-autocomplete .algolia-docsearch-suggestion {
background-color: $dropdown-bg;
}
.algolia-autocomplete .algolia-docsearch-suggestion--category-header {
color: $white;
border: 0;
border-bottom: 2px solid $blue-purple-400;
font-weight: bold;
}
.algolia-autocomplete .algolia-docsearch-suggestion--subcategory-column {
@@ -162,7 +177,6 @@
}
.algolia-autocomplete .algolia-docsearch-suggestion--text {
font-size: 0.8rem;
color: $gray-200;
}
@@ -170,7 +184,12 @@
color: $white;
background-color: $gray-700;
}
.algolia-autocomplete .ds-dropdown-menu::before {
background-color: $dropdown-bg;
}
.algolia-autocomplete .algolia-docsearch-suggestion {
background-color: $dropdown-bg;
}
.algolia-autocomplete
.algolia-docsearch-suggestion--category-header
.algolia-docsearch-suggestion--category-header-lvl0
@@ -185,8 +204,5 @@
box-shadow: none;
background-color: $gray-700;
}
}
#xrp-ledger-dev-portal {
overflow: auto !important;
}

View File

@@ -1334,4 +1334,12 @@ $company-logos-light: (
.com-card-link {
color: #7919FF !important;
}
}
.algolia-autocomplete .ds-dropdown-menu::before {
background-color: $gray-100;
}
.algolia-autocomplete .algolia-docsearch-suggestion {
background-color: $gray-100;
}
}