From e5b7c3831f21737f20386498b7a42f37d5c73418 Mon Sep 17 00:00:00 2001 From: Irfan Khan Date: Mon, 7 Oct 2024 10:42:26 +0100 Subject: [PATCH 1/5] tsx component to inject footer in html template --- react/src/injectFooter.tsx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 react/src/injectFooter.tsx diff --git a/react/src/injectFooter.tsx b/react/src/injectFooter.tsx new file mode 100644 index 0000000..c7aef31 --- /dev/null +++ b/react/src/injectFooter.tsx @@ -0,0 +1,19 @@ + +import {createRoot} from "react-dom/client" +import { DocsFooter } from '@cqcl/quantinuum-ui' + +(() => { + const mountElement = document.querySelector('.nexus-footer') + if (!mountElement) return + const renderIn = document.createElement('div') + renderIn.style.padding = '0' + renderIn.style.margin = '0' + mountElement.appendChild(renderIn) + + const root = createRoot(renderIn) + + root.render( +
+
+ ) +})() From 2784138f3507b68053780521450233ca313c9589 Mon Sep 17 00:00:00 2001 From: Irfan Khan Date: Mon, 7 Oct 2024 10:42:50 +0100 Subject: [PATCH 2/5] build system generates *.js file for footer injection --- react/tsup.config.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/react/tsup.config.ts b/react/tsup.config.ts index 591bba2..19f6ef8 100644 --- a/react/tsup.config.ts +++ b/react/tsup.config.ts @@ -22,4 +22,15 @@ export default defineConfig([ platform: "browser", format: ["iife"], clean: true, -}]) +}, +{ + entry: ['./src/injectFooter.tsx'], + outDir: 'build', + minify: true, + skipNodeModulesBundle: false, + target: "es2015", + platform: "browser", + format: ["iife"], + clean: true, +}, +]) From a43953cc24299f5b3ff4c99057d08d0abfd74b7d Mon Sep 17 00:00:00 2001 From: Irfan Khan Date: Mon, 7 Oct 2024 10:43:42 +0100 Subject: [PATCH 3/5] msft *.bat file to build quantinuum-sphinx dist folder --- build-dist.bat | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 build-dist.bat diff --git a/build-dist.bat b/build-dist.bat new file mode 100644 index 0000000..7d3455e --- /dev/null +++ b/build-dist.bat @@ -0,0 +1,18 @@ +@echo off +echo Building dist +IF exist .\dist (rmdir /s /q .\dist) +mkdir .\dist +xcopy /q /y /v /i /s /e .\quantinuum_sphinx\* .\dist +echo "Generating UI assets..." +cd .\react +call npm ci +call npm run build +echo "Copying UI assets to dist..." +copy /y /v .\build\injectNav.global.js ..\dist\_static\injectNav.global.js +copy /y /v .\build\injectFooter.global.js ..\dist\_static\injectFooter.global.js +copy /y /v .\build\syncTheme.global.js ..\dist\_static\syncTheme.global.js +copy /y /v .\node_modules\@cqcl\quantinuum-ui\dist\tokens.css ..\dist\_static\tokens.css +call npx tailwindcss --postcss .\postcss.config.cjs -i .\index.css -o ..\dist\_static\tailwind.css +echo "Done. Added UI assets to dist." +cd .. +pause \ No newline at end of file From 78046891441d440a342d1a732c8186ff6bc6e6ef Mon Sep 17 00:00:00 2001 From: Irfan Khan Date: Mon, 7 Oct 2024 10:44:08 +0100 Subject: [PATCH 4/5] modify footer in html template --- quantinuum_sphinx/_templates/page.html | 95 +++----------------------- 1 file changed, 8 insertions(+), 87 deletions(-) diff --git a/quantinuum_sphinx/_templates/page.html b/quantinuum_sphinx/_templates/page.html index ced2d56..64c0f73 100644 --- a/quantinuum_sphinx/_templates/page.html +++ b/quantinuum_sphinx/_templates/page.html @@ -189,98 +189,19 @@ {% block content %}{{ body }}{% endblock %} -