Dough Git

clove/pkviewer

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

back to web/src/lib/components/manage

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

  // A titled group of settings; the heading is a real h2 so the outline stays usable
  let {
    title,
    description,
    children,
    actions,
  }: {
    title?: string;
    description?: string | undefined;
    children: Snippet;
    actions?: Snippet;
  } = $props();
</script>

<section class="mg-section">
  {#if title}
    <div class="mg-section-head">
      <div class="mg-field-head">
        <h2>{title}</h2>
        {#if actions}
          <span class="spacer"></span>
          <div class="mg-actions">{@render actions()}</div>
        {/if}
      </div>
      {#if description}
        <p>{description}</p>
      {/if}
    </div>
  {/if}
  {@render children()}
</section>