button-glyph-simple.svelte (1024B)
1 <script lang="ts"> 2 import { 3 type GlyphKey, 4 type IClOpt, 5 fmt_cl, 6 Glyph, 7 } from "@radroots/apps-lib"; 8 import { type CallbackPromise } from "@radroots/utils"; 9 10 let { 11 basis, 12 }: { 13 basis: IClOpt & { 14 kind?: `primary` | `neutral`; 15 label: string; 16 callback: CallbackPromise; 17 glyph?: GlyphKey; 18 }; 19 } = $props(); 20 21 const classes_kind = $derived( 22 basis.kind === `neutral` ? `text-ly0-gl-shade` : `text-ly0-gl-hl`, 23 ); 24 </script> 25 26 <button 27 class={`${fmt_cl(basis.classes)} group flex flex-row justify-center items-center`} 28 onclick={basis.callback} 29 > 30 {#if basis.glyph} 31 <Glyph 32 basis={{ 33 classes: `${classes_kind}`, 34 dim: `sm+`, 35 36 key: basis.glyph, 37 }} 38 /> 39 {/if} 40 <p 41 class={`font-sans font-[600] text-line_label ${classes_kind} opacity-active`} 42 > 43 {basis.label} 44 </p> 45 </button>