app

Local-first trade for farms and co-ops
git clone https://radroots.dev/git/app.git
Log | Files | Refs | README | LICENSE

ErrorSummary.svelte (697B)


      1 <script lang="ts">
      2   import { internalHref } from '../navigation-url';
      3   let {
      4     errors
      5   }: { errors: readonly Readonly<{ href: string; text: string }>[] } = $props();
      6   const id = $props.id();
      7 </script>
      8 
      9 {#if errors.length}
     10   <section class="notice notice--error stack stack--tight" aria-labelledby={id}>
     11     <h2 {id}>Check the following fields</h2>
     12     <ul>
     13       {#each errors as error, index (index)}
     14         <li>
     15           {#if error.href.startsWith('#') && internalHref(error.href)}<a
     16               class="shell-link"
     17               href={internalHref(error.href)}>{error.text}</a
     18             >{:else}<span>{error.text}</span>{/if}
     19         </li>
     20       {/each}
     21     </ul>
     22   </section>
     23 {/if}