From a6a96e3ed3a43289056386b67d929d0d119e56ac Mon Sep 17 00:00:00 2001 From: John Holdun Date: Mon, 14 Nov 2022 14:01:59 -0800 Subject: [PATCH] Support embeds --- public/index.html | 1 - src/App.css | 19 +++++++++++++------ src/App.js | 28 +++++++++++++++++++++++----- src/Nav.js | 34 +++++++++++++++------------------- src/Section.css | 18 ++++++++++++++++++ src/Section.js | 41 ++++++++++++++++++++++++++++++----------- src/Source.css | 1 - src/index.css | 14 ++++++++++---- yarn.lock | 5 +++++ 9 files changed, 114 insertions(+), 47 deletions(-) diff --git a/public/index.html b/public/index.html index c5a08d8..07f8c14 100644 --- a/public/index.html +++ b/public/index.html @@ -39,6 +39,5 @@
- diff --git a/src/App.css b/src/App.css index f944fcf..166050e 100644 --- a/src/App.css +++ b/src/App.css @@ -2,13 +2,20 @@ @import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Serif:wght@200;400;700&display=swap'); body { - font-size:1.5em; - line-height:2em; - font-family: 'IBM Plex Sans', sans-serif; - color:#444; + font-size: 1.5em; + line-height: 2em; + font-family: 'IBM Plex Sans', sans-serif; + color: #444; +} + +.App--embedded { + background: #fff; + margin: 0 auto; + max-width: 500px; + padding: 1rem 0; } .expression { - font-weight:bold; - color:#222; + font-weight: bold; + color: #222; } diff --git a/src/App.js b/src/App.js index 4840cbf..224f563 100644 --- a/src/App.js +++ b/src/App.js @@ -36,14 +36,32 @@ const textVars = textFiles.reduce( ); function App() { - let { page } = useParams(); - if (!textVars[page]) return ; + const { page } = useParams(); + const embedded = new URLSearchParams(window.location.search).has('embed'); + + if (!textVars[page]) { + return ; + } + const [ast, astState, rawText] = textVars[page]; return ( -
-