Dough Git

clove/pkviewer

web/src/lib/components/manage/PageHeader.svelte

back to web/src/lib/components/manage

<!-- web/src/lib/components/manage/PageHeader.svelte -->
<script lang="ts">
  import type { Snippet } from "svelte";
  import Icon from "../Icon.svelte";

  // A page's title, one line of explanation, and its primary action
  let {
    title,
    description,
    actions,
    back,
  }: {
    title: string;
    description?: string;
    actions?: Snippet;
    back?: { href: string; label: string };
  } = $props();
</script>

{#if back}
  <a class="mg-back" href={back.href}>
    <Icon name="arrow-left" /> {back.label}
  </a>
{/if}
<div class="mg-pagehead">
  <div class="grow">
    <h1>{title}</h1>
    {#if description}
      <p>{description}</p>
    {/if}
  </div>
  {#if actions}
    <div class="mg-actions">{@render actions()}</div>
  {/if}
</div>