Make the landing page a box canvas, and add Link box templates
The fixed bio-and-links page is gone; / is now an editable canvas (page key "index") like /stp. The old content is kept as boxes in landingLayout.js behind an "Import old landing page" button, which now shows on a non-empty canvas too and confirms before adding. The overlay mode only the landing page used is removed from BoxCanvas. New "Link" and "Link row" HTML templates give bordered link buttons that open with target=_top/_blank, since the box is a sandboxed frame. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -1,90 +1,32 @@
|
||||
<script setup>
|
||||
/**
|
||||
* Route `/` — the professional front door. Deliberately plain: a short bio and a
|
||||
* row of links out to the CV, the personal home page (/stp), the shrines, the
|
||||
* projects that run as their own containers, and social profiles.
|
||||
* Statically imported by the router (it is the first paint).
|
||||
* Route `/` — the front door, as a box canvas (page key "index") the admin
|
||||
* arranges in the browser like /stp. The fixed bio-and-links page it
|
||||
* replaced is kept as boxes in landingLayout.js, behind the canvas's import
|
||||
* button.
|
||||
*
|
||||
* Over it lies a BoxCanvas overlay (page key "index"), where the admin pins
|
||||
* notes and anything else; admin-only notes are never sent to visitors. With
|
||||
* no boxes the overlay takes no room and the page is exactly as before.
|
||||
* Statically imported by the router (it is the first paint), but the canvas
|
||||
* is loaded in its own chunk: it brings the box editor with it.
|
||||
*/
|
||||
import { defineAsyncComponent, ref } from "vue";
|
||||
import Link from "@/components/text/Link.vue";
|
||||
import InlineLink from "@/components/text/InlineLink.vue";
|
||||
import Header from "@/components/text/Header.vue";
|
||||
import Paragraph from "@/components/text/Paragraph.vue";
|
||||
import { defineAsyncComponent } from "vue";
|
||||
import { landingLayout } from "./landingLayout";
|
||||
|
||||
// The projects are nginx routes to other containers, not SPA routes, so they
|
||||
// must be plain hrefs: a RouterLink would resolve them client-side to the 404.
|
||||
const projects = [
|
||||
{ name: "Jobs", href: "/jobs/" },
|
||||
{ name: "Tracker", href: "/tracker/" },
|
||||
{ name: "USACO", href: "/usaco/" },
|
||||
];
|
||||
|
||||
// Loaded after first paint, in its own chunk: the landing page is the one
|
||||
// view in the main bundle, and the canvas brings the box editor with it.
|
||||
const BoxCanvas = defineAsyncComponent(() =>
|
||||
import("@/views/home3/BoxCanvas.vue"),
|
||||
);
|
||||
|
||||
// The overlay is absolutely positioned, so the page grows to contain it.
|
||||
const overlayHeight = ref(0);
|
||||
|
||||
const links = [
|
||||
{ name: "GitHub", href: "https://github.com/SteveThePug" },
|
||||
{ name: "Gitea", href: "/gitea/explore/repos" },
|
||||
{ name: "Spotify", href: "https://open.spotify.com/user/stevethepug" },
|
||||
];
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<main class="relative" :style="{ minHeight: `${overlayHeight}px` }">
|
||||
<div class="flex justify-center px-4 py-16">
|
||||
<div class="max-w-xl w-full flex flex-col gap-12">
|
||||
<section>
|
||||
<Header>Adam French</Header>
|
||||
<Paragraph>
|
||||
Junior software engineer focused on full-stack development, systems
|
||||
programming, and infrastructure. First Class Honours in Computer
|
||||
Science with Mathematics from Leeds and Waterloo.
|
||||
</Paragraph>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<Header>About</Header>
|
||||
<Paragraph>
|
||||
This website is self-hosted and has a lot more on it than it needs to.
|
||||
Please have a look at my
|
||||
<InlineLink to="/cv">CV</InlineLink> for a full breakdown of my
|
||||
experience, projects, and skills. Please visit
|
||||
<InlineLink to="/stp">STP</InlineLink> for the prefered but less
|
||||
professional experience.
|
||||
</Paragraph>
|
||||
</section>
|
||||
|
||||
<nav class="navRow flex flex-row flex-wrap gap-4 justify-around">
|
||||
<Link to="/cv"> CV </Link>
|
||||
<Link to="/stp"> STP </Link>
|
||||
<Link to="/shrines"> Shrines </Link>
|
||||
<Link v-for="p in projects" :key="p.name" :href="p.href">
|
||||
{{ p.name }}
|
||||
</Link>
|
||||
<Link href="mailto:[email protected]"> Email </Link>
|
||||
<Link v-for="link in links" :key="link.name" :href="link.href">
|
||||
{{ link.name }}
|
||||
</Link>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
<BoxCanvas page="index" overlay @height="overlayHeight = $event" />
|
||||
<main class="landing">
|
||||
<BoxCanvas page="index" :starter="landingLayout" starter-label="Import old landing page" />
|
||||
</main>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.navRow > a {
|
||||
padding: 0.5rem 1rem;
|
||||
border: 1px solid currentColor;
|
||||
.landing {
|
||||
width: 100%;
|
||||
min-height: 100%;
|
||||
box-sizing: border-box;
|
||||
padding: 10px 16px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
/**
|
||||
* The pre-canvas landing page (a bio, an about paragraph and a row of links)
|
||||
* redrawn as boxes, for the "Import old landing page" button on its canvas.
|
||||
*
|
||||
* The old page was a 576px column (max-w-xl) centred in the window, 64px
|
||||
* from the top, with 48px between sections. On the 1400px design canvas that
|
||||
* centre is x = 412; the heights are the old sections' rendered heights,
|
||||
* rounded up. Boxes are unframed, as the old page had no frames.
|
||||
*/
|
||||
import { linkHtml } from "@/views/home3/templates";
|
||||
|
||||
const COLUMN = { x: 412, w: 576 };
|
||||
const GAP = 48;
|
||||
|
||||
// Header.vue's heading-with-a-rule and Paragraph.vue's padded <p>, restated
|
||||
// for the frame, which inherits none of the site's CSS.
|
||||
const SECTION_STYLE = `<style>
|
||||
body { padding: 0; font-size: 16px; }
|
||||
h1 { margin: .25rem; padding-bottom: 2px; border-bottom: 1px solid var(--color-primary); font-size: 1.5rem; }
|
||||
p { margin: 1rem 0; padding: .25rem; line-height: 1.5; }
|
||||
a { font-weight: bold; font-style: italic; text-decoration: none; }
|
||||
a:hover { color: var(--color-tertiary); }
|
||||
</style>`;
|
||||
|
||||
const section = (heading, body) => `${SECTION_STYLE}
|
||||
<h1>${heading}</h1>
|
||||
<p>
|
||||
${body}
|
||||
</p>`;
|
||||
|
||||
const SECTIONS = [
|
||||
{
|
||||
title: "Bio",
|
||||
h: 170,
|
||||
html: section(
|
||||
"Adam French",
|
||||
`Junior software engineer focused on full-stack development, systems
|
||||
programming, and infrastructure. First Class Honours in Computer
|
||||
Science with Mathematics from Leeds and Waterloo.`,
|
||||
),
|
||||
},
|
||||
{
|
||||
title: "About",
|
||||
h: 200,
|
||||
html: section(
|
||||
"About",
|
||||
`This website is self-hosted and has a lot more on it than it needs to.
|
||||
Please have a look at my <a href="/cv" target="_top">CV</a> for a full
|
||||
breakdown of my experience, projects, and skills. Please visit
|
||||
<a href="/stp" target="_top">STP</a> for the prefered but less
|
||||
professional experience.`,
|
||||
),
|
||||
},
|
||||
{
|
||||
title: "Links",
|
||||
h: 110,
|
||||
html: linkHtml([
|
||||
{ name: "CV", href: "/cv" },
|
||||
{ name: "STP", href: "/stp" },
|
||||
{ name: "Shrines", href: "/shrines" },
|
||||
{ name: "Jobs", href: "/jobs/" },
|
||||
{ name: "Tracker", href: "/tracker/" },
|
||||
{ name: "USACO", href: "/usaco/" },
|
||||
{ name: "Email", href: "mailto:[email protected]" },
|
||||
{ name: "GitHub", href: "https://github.com/SteveThePug" },
|
||||
{ name: "Gitea", href: "/gitea/explore/repos" },
|
||||
{ name: "Spotify", href: "https://open.spotify.com/user/stevethepug" },
|
||||
]),
|
||||
},
|
||||
];
|
||||
|
||||
export function landingLayout() {
|
||||
let y = 64;
|
||||
return SECTIONS.map(({ title, h, html }, i) => {
|
||||
const box = { kind: "html", title, html, framed: false, ...COLUMN, y, h, z: i + 1 };
|
||||
y += h + GAP;
|
||||
return box;
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user