devsandbox 0.11.1

Manage devcontainer-style sandboxes on docker, podman, or Apple container — many throwaway instances per repo from one TOML config.
---
// Every example page: the docs shell with an `EXAMPLE 0N` eyebrow and tags on
// top, and related examples above the reading-order pager at the bottom. The MDX
// body supplies the sections (problem, config, try it, how it works, agent
// prompt); everything around them comes from the frontmatter.
import type { MarkdownHeading } from 'astro';
import type { CollectionEntry } from 'astro:content';
import { ArrowUpRight } from '@lucide/astro';
import ExampleIcon from '../components/ExampleIcon.astro';
import '../styles/examples.css';
import Docs from './Docs.astro';

type Example = CollectionEntry<'examples'>;

interface Props {
  entry: Example;
  /** `01`-style position in reading order. */
  number: string;
  headings: MarkdownHeading[];
  related: Example[];
}

const { entry, number, headings, related } = Astro.props;
const RELATED_ID = 'related-examples';
const toc = related.length ? [...headings, { depth: 2, slug: RELATED_ID, text: 'Related examples' }] : headings;
---

<Docs
  title={entry.data.title}
  description={entry.data.description}
  eyebrow={`EXAMPLE ${number}`}
  headings={toc}
  section={{ label: 'Examples', href: '/examples' }}
  source={{ path: `site/${entry.filePath}`, action: 'edit' }}
>
  <ul class="example-page-tags" slot="topline" aria-label="Tags">
    {entry.data.tags.map((t) => <li>{t}</li>)}
  </ul>
  <slot />
  <Fragment slot="bottom">
    {
      related.length > 0 && (
        <section class="example-related" aria-labelledby={RELATED_ID}>
          <h2 id={RELATED_ID}>Related examples</h2>
          <div class="example-related-grid">
            {related.map((r) => (
              <a class="example-related-card" href={`/examples/${r.id}`}>
                <span class="example-related-icon">
                  <ExampleIcon name={r.data.icon} size={17} />
                </span>
                <span class="example-related-body">
                  <strong>{r.data.title}</strong>
                  <small>{r.data.description}</small>
                </span>
                <ArrowUpRight class="example-related-arrow" size={16} aria-hidden="true" />
              </a>
            ))}
          </div>
        </section>
      )
    }
  </Fragment>
</Docs>