Skip to content

🎥 Make videos programmatically with React

Docs: "Ask AI" button

Jonny Burger2312bcbfc4ac
diff --git a/packages/docs/src/pages/shell.tsx b/packages/docs/src/pages/shell.tsx
deleted file mode 100644
index 1c25f66a5a..0000000000
--- a/packages/docs/src/pages/shell.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import Layout from '@theme/Layout';
-import React from 'react';
-
-const Shell: React.FC = () => {
- return (
- <Layout>
- <div id="shell" />
- </Layout>
- );
-};
-
-export default Shell;
diff --git a/packages/docs/src/theme/BackToTopButton/index.tsx b/packages/docs/src/theme/BackToTopButton/index.tsx
new file mode 100644
index 0000000000..d6a6e412a0
--- /dev/null
+++ b/packages/docs/src/theme/BackToTopButton/index.tsx
@@ -0,0 +1,7 @@
+import {type ReactNode} from 'react';
+
+const BackToTopButton = (): ReactNode => {
+ return null;
+};
+
+export default BackToTopButton;
diff --git a/packages/docs/src/theme/Layout/index.tsx b/packages/docs/src/theme/Layout/index.tsx
new file mode 100644
index 0000000000..1e4406230e
--- /dev/null
+++ b/packages/docs/src/theme/Layout/index.tsx
@@ -0,0 +1,25 @@
+import type {WrapperProps} from '@docusaurus/types';
+import {AskAi} from '@remotion/promo-pages/dist/Ai.js';
+import '@remotion/promo-pages/dist/tailwind.css';
+import Layout from '@theme-original/Layout';
+import type LayoutType from '@theme/Layout';
+import React, {type ReactNode} from 'react';
+
+type Props = WrapperProps<typeof LayoutType>;
+
+const LayoutWrapper = (props: Props): ReactNode => {
+ return (
+ <>
+ <Layout {...props} />
+ <script
+ src="https://crawlchat.app/embed.js"
+ id="crawlchat-script"
+ async
+ data-id="67c0a28c5b075f0bb35e5366"
+ />
+ <AskAi />
+ </>
+ );
+};
+
+export default LayoutWrapper;
diff --git a/packages/promo-pages/bundle.ts b/packages/promo-pages/bundle.ts
index f5a843861f..fbdf18a3da 100644
--- a/packages/promo-pages/bundle.ts
+++ b/packages/promo-pages/bundle.ts
@@ -26,6 +26,7 @@ const result = await Bun.build({
entrypoints: [
'./src/components/Homepage.tsx',
'./src/components/homepage/Pricing.tsx',
+ './src/components/Ai.tsx',
],
format: 'esm',
external: [
diff --git a/packages/promo-pages/src/components/Ai.tsx b/packages/promo-pages/src/components/Ai.tsx
new file mode 100644
index 0000000000..45fc9b4dcf
--- /dev/null
+++ b/packages/promo-pages/src/components/Ai.tsx
@@ -0,0 +1,22 @@
+import React, {useCallback} from 'react';
+
+export const AskAi: React.FC = () => {
+ const click = useCallback(() => {
+ // @ts-expect-error
+ window.crawlchatEmbed.show();
+ }, []);
+
+ return (
+ <button
+ type="button"
+ onClick={click}
+ style={{
+ backgroundColor: '#282A36',
+ cursor: 'pointer',
+ }}
+ className="rounded-full text-white fixed z-10 bottom-8 right-8 fontbrand appearance-none border-none px-4 py-2 font-medium text-sm"
+ >
+ Ask AI
+ </button>
+ );
+};