fix ui package, use sv to create
recreated package using sv, marking correctly as a library. seems I was missing some sveltekit tooling somewhere along the way otherwise.
This commit is contained in:
40
src/lib/FramelessButton.svelte
Normal file
40
src/lib/FramelessButton.svelte
Normal file
@@ -0,0 +1,40 @@
|
||||
<script lang="ts">
|
||||
import type { Snippet } from 'svelte';
|
||||
import type { MouseEventHandler } from 'svelte/elements';
|
||||
|
||||
let {
|
||||
icon,
|
||||
iconPosition = 'right',
|
||||
disabled = false,
|
||||
children,
|
||||
onclick
|
||||
}: {
|
||||
icon?: string;
|
||||
iconPosition?: 'left' | 'right';
|
||||
disabled?: boolean;
|
||||
children: Snippet;
|
||||
onclick?: MouseEventHandler<HTMLButtonElement>;
|
||||
} = $props();
|
||||
</script>
|
||||
|
||||
{#snippet iconSnippet()}
|
||||
<span class="material-symbols-outlined">{icon}</span>
|
||||
{/snippet}
|
||||
|
||||
<button
|
||||
class={[
|
||||
'text-accent hover:text-primary inline-flex items-center gap-1.5 transition-colors',
|
||||
disabled && 'pointer-events-none cursor-not-allowed opacity-50'
|
||||
]}
|
||||
{onclick}
|
||||
>
|
||||
{#if icon && iconPosition === 'left'}
|
||||
{@render iconSnippet()}
|
||||
{/if}
|
||||
|
||||
{@render children()}
|
||||
|
||||
{#if icon && iconPosition === 'right'}
|
||||
{@render iconSnippet()}
|
||||
{/if}
|
||||
</button>
|
||||
Reference in New Issue
Block a user