Skip to content

Commit

Permalink
feat(docs): Cookbook integration (#8083)
Browse files Browse the repository at this point in the history
  • Loading branch information
catmcgee authored Aug 20, 2024
1 parent ff0effe commit 19bd8a9
Show file tree
Hide file tree
Showing 3 changed files with 1,551 additions and 59 deletions.
1 change: 1 addition & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"rewrite": "node ./scripts/rewrite_paths.js"
},
"dependencies": {
"@cookbookdev/docsbot": "^4.21.12",
"@docusaurus/core": "^3.0.1",
"@docusaurus/plugin-ideal-image": "^3.0.1",
"@docusaurus/preset-classic": "^3.0.1",
Expand Down
5 changes: 5 additions & 0 deletions docs/src/theme/Root.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ import React from 'react';
import useMatomo from '@site/src/components/Matomo/matomo';
import BrowserOnly from '@docusaurus/BrowserOnly';
import useIsBrowser from '@docusaurus/useIsBrowser';
import AskCookbook from '@cookbookdev/docsbot/react';

function OptOutForm() {
const banner = useMatomo();

return <>{banner}</>;
}

/** It's a public API key, so it's safe to expose it here. */
const COOKBOOK_PUBLIC_API_KEY = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI2NmIyOWRmZDM3ZWIwYzRiMTVlZGYzMDAiLCJpYXQiOjE3MjI5ODE4ODUsImV4cCI6MjAzODU1Nzg4NX0.19rsZIFNmgVEbpmDjEJ8oPnL7uHYePytf-Ex1pjm2_8';

export default function Root({ children }) {
const useIsBrowserValue = useIsBrowser();
if (!useIsBrowserValue) return <>{children}</>;
Expand All @@ -17,6 +21,7 @@ export default function Root({ children }) {
<>
{children}
<BrowserOnly>{() => <OptOutForm />}</BrowserOnly>
<BrowserOnly>{() => <AskCookbook apiKey={COOKBOOK_PUBLIC_API_KEY} />}</BrowserOnly>
</>
);
}
Loading

0 comments on commit 19bd8a9

Please sign in to comment.