Mirror to Gitea / mirror (push) Skipped
Each page now has its own look drawn from print and retro-tech references: magazine-cover home, subway-map work index, technical-poster project pages, 90s-desktop blog, radio-flyer music page, 80s wireframe 3D page, garden about page and postcard contact form. A shared subway-line color system ties sections and project categories together. Replace themed copy with standard wording (Work, Blog, Music, 3D, About, Contact; Selected work, Experience, Get in touch). Rename /log to /blog and /sound to /music with redirects.
92 lines
2.7 KiB
Plaintext
92 lines
2.7 KiB
Plaintext
---
|
|
import { getCollection } from 'astro:content';
|
|
import Base from '../../layouts/Base.astro';
|
|
import { media } from '../../lib/media';
|
|
|
|
export async function getStaticPaths() {
|
|
const games = await getCollection('work', ({ data }) => !!data.game);
|
|
return games.map((project) => ({ params: { slug: project.id }, props: { project } }));
|
|
}
|
|
|
|
const { project } = Astro.props;
|
|
const game = project.data.game!;
|
|
const src = media(`${game.path}/${game.entry}`);
|
|
---
|
|
|
|
<Base title={`Play ${project.data.title}`} description={project.data.summary} theme={project.data.theme}>
|
|
<section class="wrap section">
|
|
<a class="back" href={`/work/${project.id}`}>← {project.data.title}</a>
|
|
<div class="cabinet" style={`--ratio: ${game.aspect}`}>
|
|
<div class="top label">
|
|
<span>{project.data.title}</span>
|
|
<span>{game.engine === 'godot' ? 'Godot' : game.engine === 'unity' ? 'Unity' : 'Web'} build</span>
|
|
</div>
|
|
<button class="placeholder boot" type="button">▶ Click to play</button>
|
|
<div class="bottom cluster">
|
|
<button class="btn fs" type="button">Fullscreen</button>
|
|
<a class="btn" href={src} target="_blank" rel="noopener">Open in new tab ↗</a>
|
|
<span class="label">Click into the game to give it keyboard focus.</span>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</Base>
|
|
|
|
<script is:inline define:vars={{ src }}>
|
|
// Load the game on demand so the page itself stays light.
|
|
(() => {
|
|
const cab = document.querySelector('.cabinet');
|
|
const boot = cab.querySelector('.boot');
|
|
boot.addEventListener('click', () => {
|
|
const frame = document.createElement('iframe');
|
|
frame.src = src;
|
|
frame.title = 'Game';
|
|
frame.allow = 'fullscreen; autoplay; gamepad; cross-origin-isolated';
|
|
frame.className = 'screen';
|
|
boot.replaceWith(frame);
|
|
frame.focus();
|
|
});
|
|
cab.querySelector('.fs').addEventListener('click', () => {
|
|
(cab.querySelector('.screen') ?? cab).requestFullscreen?.();
|
|
});
|
|
})();
|
|
</script>
|
|
|
|
<style>
|
|
.back {
|
|
display: inline-block;
|
|
margin-bottom: var(--space-5);
|
|
text-decoration: none;
|
|
}
|
|
.cabinet {
|
|
border: var(--border-w) solid var(--line-strong);
|
|
background: var(--bg-sunken);
|
|
}
|
|
.top,
|
|
.bottom {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
padding: var(--space-2) var(--space-4);
|
|
}
|
|
.top {
|
|
border-bottom: 1px solid var(--line);
|
|
}
|
|
.bottom {
|
|
justify-content: flex-start;
|
|
border-top: 1px solid var(--line);
|
|
}
|
|
.boot,
|
|
.cabinet :global(.screen) {
|
|
display: block;
|
|
width: 100%;
|
|
aspect-ratio: var(--ratio);
|
|
border: 0;
|
|
}
|
|
.boot {
|
|
cursor: pointer;
|
|
font-size: var(--step-1);
|
|
}
|
|
.boot:hover {
|
|
color: var(--accent);
|
|
}
|
|
</style>
|