Dough Git

clove/allInOne

web/src/lib/components/PageHead.svelte

back to web/src/lib/components

<!-- src/lib/components/PageHead.svelte
     Copyright (c) 2026 Clove Nytrix Doughmination Twilight
     Licensed under the DASL-1.0 Licence.
     See LICENCE.md in the project root for full licence information.
-->

<script lang="ts">
  import IcArrowBack from "~icons/ic/outline-arrow-back";
  let {
    eyebrow = "",
    title,
    subtitle = "",
    back,
  }: {
    eyebrow?: string;
    title: string;
    subtitle?: string;
    back?: {
      href: string;
      label: string;
    };
  } = $props();
</script>

<div class="head">
  <div class="page-head">
    {#if eyebrow}
      <p class="eyebrow">{eyebrow}</p>
    {/if}
    <h1>{title}</h1>
    {#if subtitle}
      <p class="muted">{subtitle}</p>
    {/if}
  </div>
  {#if back}
    <a class="back-link" href={back.href}>
      <IcArrowBack width="16" height="16" />{back.label}
    </a>
  {/if}
</div>

<style>
  .head {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-start;
    justify-content: space-between;
    padding-block-end: 1rem;
    border-bottom: 1px solid var(--line);
  }

  .back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding-block: 0.3rem;
    color: var(--muted);
    font-size: 0.875rem;
    text-decoration: none;
  }

  .back-link:hover {
    color: var(--text);
  }
</style>