make button children snippet

This commit is contained in:
Benjamin Palko 2024-12-30 18:43:12 -05:00
parent 2624df7cc9
commit 3c34cb0e11
2 changed files with 6 additions and 5 deletions

View file

@ -1,12 +1,13 @@
<script lang="ts"> <script lang="ts">
import type { DaisyColor, DaisySize } from '$lib/types'; import type { DaisyColor, DaisySize } from '$lib/types';
import type { Snippet } from 'svelte';
import type { HTMLButtonAttributes } from 'svelte/elements'; import type { HTMLButtonAttributes } from 'svelte/elements';
interface Props { interface Props {
block?: boolean; block?: boolean;
children: Snippet;
color?: DaisyColor; color?: DaisyColor;
glass?: boolean; glass?: boolean;
label: string;
outline?: boolean; outline?: boolean;
onClick?: () => void; onClick?: () => void;
responsive?: boolean; responsive?: boolean;
@ -17,9 +18,9 @@
let { let {
block = false, block = false,
children,
color, color,
glass = false, glass = false,
label,
outline = false, outline = false,
onClick, onClick,
responsive = false, responsive = false,
@ -51,7 +52,7 @@
class:btn-error={color === 'error'} class:btn-error={color === 'error'}
class={`btn ${responsive && 'btn-xs sm:btn-sm md:btn-md lg:btn-lg'}`} class={`btn ${responsive && 'btn-xs sm:btn-sm md:btn-md lg:btn-lg'}`}
> >
{label} {@render children()}
</button> </button>
<style></style> <style></style>

View file

@ -54,7 +54,7 @@
{/if} {/if}
</div> </div>
<div class="card-actions px-4"> <div class="card-actions px-4">
<Button block type="submit" label={messages.login_button_submit()} outline /> <Button block type="submit" outline>{messages.login_button_submit()}</Button>
</div> </div>
</form> </form>
{/snippet} {/snippet}