From 4158d546aab450138278bb9dfcd402a6bde29ede Mon Sep 17 00:00:00 2001 From: jlenon7 Date: Thu, 19 Dec 2024 13:25:42 +0000 Subject: [PATCH] feat: integrate with mendable --- docusaurus.config.js | 178 ++++++++++++++++++++-------------------- package-lock.json | 119 ++++++++++++++++++++++++++- package.json | 4 +- src/theme/SearchBar.tsx | 19 +++++ 4 files changed, 231 insertions(+), 89 deletions(-) create mode 100644 src/theme/SearchBar.tsx diff --git a/docusaurus.config.js b/docusaurus.config.js index 6454b737..a2daee4a 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -3,47 +3,51 @@ /** @type {import('@docusaurus/types').Config} */ const config = { - title: 'Athenna Framework', - tagline: 'One foundation for multiple applications', - favicon: 'img/favicons/minerva.ico', - url: 'https://athenna.io', + title: "Athenna Framework", + tagline: "One foundation for multiple applications", + favicon: "img/favicons/minerva.ico", + url: "https://athenna.io", // Set the // pathname under which your site is served // For GitHub pages deployment, it is often '//' - baseUrl: '/', + baseUrl: "/", - organizationName: 'AthennaIO', - projectName: 'Docs', - deploymentBranch: 'main', + organizationName: "AthennaIO", + projectName: "Docs", + deploymentBranch: "main", trailingSlash: false, - onBrokenLinks: 'warn', - onBrokenMarkdownLinks: 'warn', + onBrokenLinks: "warn", + onBrokenMarkdownLinks: "warn", i18n: { - defaultLocale: 'en', - locales: ['en'], + defaultLocale: "en", + locales: ["en"], + }, + + customFields: { + mendableAnonKey: "2ffe6aa8-b8a6-4889-847f-53d5c7095403", }, markdown: { mermaid: true, }, - themes: ['@docusaurus/theme-mermaid'], + themes: ["@docusaurus/theme-mermaid"], presets: [ [ - 'classic', + "classic", /** @type {import('@docusaurus/preset-classic').Options} */ ({ docs: { breadcrumbs: false, - sidebarPath: require.resolve('./src/sidebars.js'), - editUrl: 'https://github.com/AthennaIO/Docs/tree/main/', + sidebarPath: require.resolve("./src/sidebars.js"), + editUrl: "https://github.com/AthennaIO/Docs/tree/main/", }, theme: { - customCss: require.resolve('./static/css/root.css'), + customCss: require.resolve("./static/css/root.css"), }, gtag: { - trackingID: 'G-TPPC0L9LCF', + trackingID: "G-TPPC0L9LCF", anonymizeIP: false, }, }), @@ -53,133 +57,133 @@ const config = { themeConfig: /** @type {import('@docusaurus/preset-classic').ThemeConfig} */ ({ - image: 'img/pre-visualization/home.png', + image: "img/pre-visualization/home.png", metadata: [ - { - name: 'og:description', - content: 'One foundation for multiple applications' + { + name: "og:description", + content: "One foundation for multiple applications", }, { - name: 'theme-color', - content: '#9580ff' - } + name: "theme-color", + content: "#9580ff", + }, ], navbar: { - title: 'Athenna', + title: "Athenna", logo: { - alt: 'Athenna Framework', - src: 'img/logos/logo.png', + alt: "Athenna Framework", + src: "img/logos/logo.png", }, items: [ { - type: 'doc', - docId: 'getting-started/installation', - label: 'Docs', - position: 'right', + type: "doc", + docId: "getting-started/installation", + label: "Docs", + position: "right", }, { - to: 'benchmarks', - label: 'Benchmarks', - position: 'right', + to: "benchmarks", + label: "Benchmarks", + position: "right", }, { - href: 'https://github.com/AthennaIO', - 'aria-label': 'GitHub', - className: 'navbar__icon navbar__github', - position: 'right', + href: "https://github.com/AthennaIO", + "aria-label": "GitHub", + className: "navbar__icon navbar__github", + position: "right", html: '', }, { - href: 'https://discord.gg/JdEbBAKw6X', - 'aria-label': 'Discord', - className: 'navbar__icon navbar__discord', - position: 'right', + href: "https://discord.gg/JdEbBAKw6X", + "aria-label": "Discord", + className: "navbar__icon navbar__discord", + position: "right", html: '', }, { - href: 'https://twitter.com/athennaio', - 'aria-label': 'Twitter', - className: 'navbar__icon navbar__twitter', - position: 'right', + href: "https://twitter.com/athennaio", + "aria-label": "Twitter", + className: "navbar__icon navbar__twitter", + position: "right", html: '', }, { - href: 'https://www.youtube.com/watch?v=wNMrx6OGKFk', - 'aria-label': 'YouTube', - className: 'navbar__icon navbar__youtube', - position: 'right', + href: "https://www.youtube.com/watch?v=wNMrx6OGKFk", + "aria-label": "YouTube", + className: "navbar__icon navbar__youtube", + position: "right", html: '', }, ], }, prism: { additionalLanguages: ["json", "bash", "typescript", "sql"], - theme: require('./lib/prism/dracula'), + theme: require("./lib/prism/dracula"), }, }), plugins: [ [ - '@docusaurus/plugin-pwa', + "@docusaurus/plugin-pwa", { debug: true, offlineModeActivationStrategies: [ - 'appInstalled', - 'standalone', - 'queryString', + "appInstalled", + "standalone", + "queryString", ], pwaHead: [ { - tagName: 'link', - rel: 'icon', - href: 'img/logos/minerva.png', + tagName: "link", + rel: "icon", + href: "img/logos/minerva.png", }, { - tagName: 'link', - rel: 'manifest', - href: 'manifest.json', + tagName: "link", + rel: "manifest", + href: "manifest.json", }, { - tagName: 'meta', - name: 'theme-color', - content: '#ffffff', - media: '(prefers-color-scheme: light)', + tagName: "meta", + name: "theme-color", + content: "#ffffff", + media: "(prefers-color-scheme: light)", }, { - tagName: 'meta', - name: 'theme-color', - content: '#242526', - media: '(prefers-color-scheme: dark)', + tagName: "meta", + name: "theme-color", + content: "#242526", + media: "(prefers-color-scheme: dark)", }, { - tagName: 'meta', - name: 'apple-mobile-web-app-capable', - content: 'yes', + tagName: "meta", + name: "apple-mobile-web-app-capable", + content: "yes", }, { - tagName: 'meta', - name: 'apple-mobile-web-app-status-bar-style', - content: '#000', + tagName: "meta", + name: "apple-mobile-web-app-status-bar-style", + content: "#000", }, { - tagName: 'link', - rel: 'apple-touch-icon', - href: 'img/logos/minerva.png', + tagName: "link", + rel: "apple-touch-icon", + href: "img/logos/minerva.png", }, { - tagName: 'link', - rel: 'mask-icon', - href: 'img/logos/minerva.png', - color: 'rgb(80,27,134)', + tagName: "link", + rel: "mask-icon", + href: "img/logos/minerva.png", + color: "rgb(80,27,134)", }, { - tagName: 'meta', - name: 'msapplication-TileColor', - content: '#000', + tagName: "meta", + name: "msapplication-TileColor", + content: "#000", }, ], }, ], - ] + ], }; module.exports = config; diff --git a/package-lock.json b/package-lock.json index 210abafd..366de1a7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,12 +19,14 @@ "@fortawesome/free-solid-svg-icons": "^6.6.0", "@fortawesome/react-fontawesome": "^0.2.2", "@mdx-js/react": "^3.0.1", + "@mendable/search": "^0.0.206", "clsx": "^2.1.1", "prism": "^4.1.2", "prism-react-renderer": "^2.4.0", "react": "^18.3.1", "react-dom": "^18.3.1", - "react-player": "^2.16.0" + "react-player": "^2.16.0", + "swizzle": "^1.1.0" }, "devDependencies": { "@docusaurus/module-type-aliases": "^3.0.0" @@ -3302,6 +3304,19 @@ "react": ">=16" } }, + "node_modules/@mendable/search": { + "version": "0.0.206", + "resolved": "https://registry.npmjs.org/@mendable/search/-/search-0.0.206.tgz", + "integrity": "sha512-T1qvSL4S0YXnQXaBjJ7DVzBDv+EpaPOm7ovacjL6qg5AtxdK8csF6T2rxj82hJBLcFzKmghEq8A8dQkfNiHLLw==", + "dependencies": { + "html-react-parser": "^4.2.0", + "posthog-js": "^1.45.1" + }, + "peerDependencies": { + "react": "^17.x || ^18.x", + "react-dom": "^17.x || ^18.x" + } + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -7950,6 +7965,11 @@ "node": ">=0.4.0" } }, + "node_modules/fflate": { + "version": "0.4.8", + "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.4.8.tgz", + "integrity": "sha512-FJqqoDBR00Mdj9ppamLa/Y7vxm+PRmNWA67N846RvsoYVMKB4q3y/de5PA7gUmRMYK/8CMz2GDZQmCRN1wBcWA==" + }, "node_modules/file-loader": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/file-loader/-/file-loader-6.2.0.tgz", @@ -9103,6 +9123,33 @@ "safe-buffer": "~5.1.0" } }, + "node_modules/html-dom-parser": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/html-dom-parser/-/html-dom-parser-5.0.3.tgz", + "integrity": "sha512-slsc6ipw88OUZjAayRs5NTmfOQCwcUa3hNyk6AdsbQxY09H5Lr1Y3CZ4ZlconMKql3Ga6sWg3HMoUzo7KSItaQ==", + "dependencies": { + "domhandler": "5.0.3", + "htmlparser2": "9.0.0" + } + }, + "node_modules/html-dom-parser/node_modules/htmlparser2": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-9.0.0.tgz", + "integrity": "sha512-uxbSI98wmFT/G4P2zXx4OVx04qWUmyFPrD2/CNepa2Zo3GPNaCaaxElDgwUrwYWkK1nr9fft0Ya8dws8coDLLQ==", + "funding": [ + "https://github.com/fb55/htmlparser2?sponsor=1", + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "dependencies": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3", + "domutils": "^3.1.0", + "entities": "^4.5.0" + } + }, "node_modules/html-entities": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.5.2.tgz", @@ -9155,6 +9202,20 @@ "node": ">=14" } }, + "node_modules/html-react-parser": { + "version": "4.2.10", + "resolved": "https://registry.npmjs.org/html-react-parser/-/html-react-parser-4.2.10.tgz", + "integrity": "sha512-JyKZVQ+kQ8PdycISwkuLbEEvV/k4hWhU6cb6TT7yGaYwdqA7cPt4VRYXkCZcix2vlQtgDBSMJUmPI2jpNjPGvg==", + "dependencies": { + "domhandler": "5.0.3", + "html-dom-parser": "5.0.3", + "react-property": "2.0.2", + "style-to-js": "1.1.8" + }, + "peerDependencies": { + "react": "0.14 || 15 || 16 || 17 || 18" + } + }, "node_modules/html-tags": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/html-tags/-/html-tags-3.3.1.tgz", @@ -14702,6 +14763,26 @@ "postcss": "^8.4.31" } }, + "node_modules/posthog-js": { + "version": "1.202.2", + "resolved": "https://registry.npmjs.org/posthog-js/-/posthog-js-1.202.2.tgz", + "integrity": "sha512-9p7dAWuCfoM0WrasubGwtC8i38HU3iMqK3gd0mhyAoTrEVMVozTQq64Toc2VEv8H69NGNn6ikk5t2LclHT9XFA==", + "dependencies": { + "core-js": "^3.38.1", + "fflate": "^0.4.8", + "preact": "^10.19.3", + "web-vitals": "^4.2.0" + } + }, + "node_modules/preact": { + "version": "10.25.3", + "resolved": "https://registry.npmjs.org/preact/-/preact-10.25.3.tgz", + "integrity": "sha512-dzQmIFtM970z+fP9ziQ3yG4e3ULIbwZzJ734vaMVUTaKQ2+Ru1Ou/gjshOYVHCcd1rpAelC6ngjvjDXph98unQ==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/preact" + } + }, "node_modules/pretty-bytes": { "version": "5.6.0", "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz", @@ -15295,6 +15376,11 @@ "react": ">=16.6.0" } }, + "node_modules/react-property": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/react-property/-/react-property-2.0.2.tgz", + "integrity": "sha512-+PbtI3VuDV0l6CleQMsx2gtK0JZbZKbpdu5ynr+lbsuvtmgbNcS3VM0tuY2QjFNOcWxvXeHjDpy42RO+4U2rug==" + }, "node_modules/react-router": { "version": "5.3.4", "resolved": "https://registry.npmjs.org/react-router/-/react-router-5.3.4.tgz", @@ -16878,6 +16964,27 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/style-to-js": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/style-to-js/-/style-to-js-1.1.8.tgz", + "integrity": "sha512-bPSspCXkkhETLXnEgDbaoWRWyv3lF2bj32YIc8IElok2IIMHUlZtQUrxYmAkKUNxpluhH0qnKWrmuoXUyTY12g==", + "dependencies": { + "style-to-object": "1.0.3" + } + }, + "node_modules/style-to-js/node_modules/inline-style-parser": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.2.2.tgz", + "integrity": "sha512-EcKzdTHVe8wFVOGEYXiW9WmJXPjqi1T+234YpJr98RiFYKHV3cdy1+3mkTE+KHTHxFFLH51SfaGOoUdW+v7ViQ==" + }, + "node_modules/style-to-js/node_modules/style-to-object": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-1.0.3.tgz", + "integrity": "sha512-xOpx7S53E0V3DpVsvt7ySvoiumRpfXiC99PUXLqGB3wiAnN9ybEIpuzlZ8LAZg+h1sl9JkEUwtSQXxcCgFqbbg==", + "dependencies": { + "inline-style-parser": "0.2.2" + } + }, "node_modules/style-to-object": { "version": "0.4.4", "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-0.4.4.tgz", @@ -16973,6 +17080,11 @@ "node": ">= 10" } }, + "node_modules/swizzle": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/swizzle/-/swizzle-1.1.0.tgz", + "integrity": "sha512-L5wVfkVqNbYsz6xAPgPLo/ra7TyA+7nYvNm4i+LH6naTm8p7VKlVu/WmQWJ5yU03Gcabb34KfVppHcrGNdzi5Q==" + }, "node_modules/symbol-observable": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz", @@ -18059,6 +18171,11 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/web-vitals": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/web-vitals/-/web-vitals-4.2.4.tgz", + "integrity": "sha512-r4DIlprAGwJ7YM11VZp4R884m0Vmgr6EAKe3P+kO0PPj3Unqyvv59rczf6UiGcb9Z8QxZVcqKNwv/g0WNdWwsw==" + }, "node_modules/web-worker": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/web-worker/-/web-worker-1.3.0.tgz", diff --git a/package.json b/package.json index 7cdd5cbf..cd517fd6 100644 --- a/package.json +++ b/package.json @@ -25,12 +25,14 @@ "@fortawesome/free-solid-svg-icons": "^6.6.0", "@fortawesome/react-fontawesome": "^0.2.2", "@mdx-js/react": "^3.0.1", + "@mendable/search": "^0.0.206", "clsx": "^2.1.1", "prism": "^4.1.2", "prism-react-renderer": "^2.4.0", "react": "^18.3.1", "react-dom": "^18.3.1", - "react-player": "^2.16.0" + "react-player": "^2.16.0", + "swizzle": "^1.1.0" }, "devDependencies": { "@docusaurus/module-type-aliases": "^3.0.0" diff --git a/src/theme/SearchBar.tsx b/src/theme/SearchBar.tsx new file mode 100644 index 00000000..849c3114 --- /dev/null +++ b/src/theme/SearchBar.tsx @@ -0,0 +1,19 @@ +import React from "react"; +import { MendableSearchBar } from "@mendable/search"; +import useDocusaurusContext from "@docusaurus/useDocusaurusContext"; + +export default function SearchBarWrapper() { + const { + siteConfig: { customFields }, + } = useDocusaurusContext(); + return ( +
+ +
+ ); +}