Astro + React islands + MDX with a theme system (terminal, concrete, nostromo, overgrowth), USMT Dash case study, work/log/sound/models/about/ contact pages, RSS, self-hosted contact form over SMTP, /media proxy to Nextcloud, Dockerfile for Coolify, and a GitHub Action that mirrors main to Gitea.
This commit is contained in:
64 files changed
+9066
No files matched your search
@@ -0,0 +1,91 @@
|
||||
---
|
||||
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="label 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} build</span>
|
||||
</div>
|
||||
<button class="placeholder boot" type="button">[ insert coin ▶ ]</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>
|
||||
Reference in new issue
Block a user