기본 컴포넌트 추가

This commit is contained in:
static
2024-12-26 00:32:33 +09:00
parent e6f345bd3b
commit 8771b324a1
9 changed files with 141 additions and 1 deletions

View File

@@ -0,0 +1,28 @@
<script lang="ts">
interface Props {
children?: any;
color?: "primary" | "gray";
onclick?: () => void;
}
let { children, color = "primary", onclick }: Props = $props();
let bgColorStyle = $derived(
{
primary: "bg-primary-600 active:bg-primary-500",
gray: "bg-gray-300 active:bg-gray-400",
}[color],
);
let fontColorStyle = $derived(
{
primary: "text-white",
gray: "text-gray-800",
}[color],
);
</script>
<button {onclick} class="{bgColorStyle} {fontColorStyle} h-12 rounded-xl font-medium">
<div class="h-full w-full p-3 transition active:scale-95">
{@render children?.()}
</div>
</button>