1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-10-28 14:45:52 -04:00

remove per-page getLayout option (maybe temporarily?)

This commit is contained in:
2022-04-19 17:38:20 -04:00
parent d5690d2972
commit d50ae0f85a
10 changed files with 228 additions and 314 deletions

View File

@@ -1,9 +1,7 @@
import { useEffect } from "react";
import { useEffect, useState } from "react";
import dynamic from "next/dynamic";
import { NextSeo } from "next-seo";
import Layout from "../components/Layout";
import Wallpaper from "../components/Wallpaper";
import type { ReactElement } from "react";
import { styled } from "../lib/styles/stitches.config";
// obviously, an interactive VNC display will not work even a little bit server-side
const VNC = dynamic(() => import("../components/VNC"), { ssr: false });
@@ -11,7 +9,25 @@ const VNC = dynamic(() => import("../components/VNC"), { ssr: false });
// https://github.com/jakejarvis/y2k
const SOCKET_PROXY = "wss://y2k.jrvs.io";
const Wallpaper = styled("div", {
display: "flex",
width: "100%",
minHeight: "450px",
padding: "1.5em 0",
justifyContent: "center",
alignItems: "center",
backgroundRepeat: "repeat",
backgroundPosition: "center",
});
const Y2K = () => {
const [wallpaperUrl, setWallpaperUrl] = useState("");
// set a random retro Windows ME desktop tile for the entire content area
useEffect(() => {
setWallpaperUrl(`/static/images/y2k/tiles/tile_${Math.floor(20 * Math.random())}.png`);
}, []);
// print a fancy console message (in browser only) just for funsies
useEffect(() => {
console.log(
@@ -39,32 +55,11 @@ const Y2K = () => {
}}
/>
<VNC server={SOCKET_PROXY} />
<Wallpaper style={{ backgroundImage: wallpaperUrl ? `url(${wallpaperUrl})` : "" }}>
<VNC server={SOCKET_PROXY} />
</Wallpaper>
</>
);
};
// disable layout's default styles so the wallpaper component can go edge-to-edge:
Y2K.getLayout = (page: ReactElement) => {
// set a random retro Windows ME desktop tile for the entire content area
const randomTile = `/static/images/y2k/tiles/tile_${Math.floor(20 * Math.random())}.png`;
return (
<Layout container={false} stickyHeader={false}>
<Wallpaper
image={randomTile}
tile
css={{
display: "flex",
justifyContent: "center",
alignItems: "center",
padding: "1.5em 0",
}}
>
{page}
</Wallpaper>
</Layout>
);
};
export default Y2K;