diff --git a/src/app.css b/src/app.css index c5c16f7..5881e52 100644 --- a/src/app.css +++ b/src/app.css @@ -440,3 +440,28 @@ input[type="checkbox"]:checked::before { transform-origin: bottom left; background-color: var(--color-surface2); } +.image-overlay::before { + content: ""; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + background: rgba(255, 255, 255, 0.1); +} +.iframe-wrapper { + position: relative; + min-height: 300px; + width: 100%; + min-width: 350px; + max-width: 100% !important; + background-color: black; +} + +.iframe-wrapper iframe { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} diff --git a/src/app.tsx b/src/app.tsx index b629303..48249b1 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -1,27 +1,21 @@ import { Router } from "@solidjs/router"; import { FileRoutes } from "@solidjs/start/router"; -import { createEffect, createSignal, ErrorBoundary, Suspense } from "solid-js"; +import { createEffect, ErrorBoundary, Suspense } from "solid-js"; import "./app.css"; import { LeftBar, RightBar } from "./components/Bars"; import { TerminalSplash } from "./components/TerminalSplash"; import { SplashProvider } from "./context/splash"; import { MetaProvider } from "@solidjs/meta"; import ErrorBoundaryFallback from "./components/ErrorBoundaryFallback"; +import { BarsProvider, useBars } from "./context/bars"; -export default function App() { - let leftBarRef: HTMLDivElement | undefined; - let rightBarRef: HTMLDivElement | undefined; - const [contentWidth, setContentWidth] = createSignal(0); - const [contentWidthOffset, setContentWidthOffset] = createSignal(0); +function AppLayout(props: { children: any }) { + const { leftBarSize, rightBarSize, setCenterWidth, centerWidth } = useBars(); createEffect(() => { const handleResize = () => { - if (leftBarRef && rightBarRef) { - setContentWidth( - window.innerWidth - leftBarRef.clientWidth - rightBarRef.clientWidth - ); - setContentWidthOffset(leftBarRef.clientWidth); - } + const newWidth = window.innerWidth - leftBarSize() - rightBarSize(); + setCenterWidth(newWidth); }; handleResize(); @@ -31,6 +25,23 @@ export default function App() { return () => window.removeEventListener("resize", handleResize); }); + return ( +
+ +
+ {props.children} +
+ +
+ ); +} + +export default function App() { return ( @@ -39,27 +50,12 @@ export default function App() { )} > -
+ - ( -
- -
- {props.children} -
- -
- )} - > + {props.children}}> -
+
diff --git a/src/components/Bars.tsx b/src/components/Bars.tsx index 4ff54fc..6f5b7f7 100644 --- a/src/components/Bars.tsx +++ b/src/components/Bars.tsx @@ -1,7 +1,26 @@ import { Typewriter } from "./Typewriter"; +import { useBars } from "~/context/bars"; +import { createEffect, onMount } from "solid-js"; + +export function LeftBar() { + const { setLeftBarSize } = useBars(); + let ref: HTMLDivElement | undefined; + + onMount(() => { + if (ref) { + const updateSize = () => { + setLeftBarSize(ref?.offsetWidth || 0); + }; + + updateSize(); + + const resizeObserver = new ResizeObserver(updateSize); + resizeObserver.observe(ref); + + return () => resizeObserver.disconnect(); + } + }); -export function LeftBar(props: { ref: HTMLDivElement | undefined }) { - let ref = props.ref; return (