feat: add Heading component
This commit is contained in:
27
src/lib/components/atoms/Heading.svelte
Normal file
27
src/lib/components/atoms/Heading.svelte
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import type { Snippet } from 'svelte';
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
size?: 'small' | 'medium' | 'large';
|
||||||
|
spacing?: 'none' | 'small' | 'medium' | 'large';
|
||||||
|
children: Snippet;
|
||||||
|
};
|
||||||
|
|
||||||
|
let { size = 'medium', spacing = 'medium', children }: Props = $props();
|
||||||
|
|
||||||
|
const sizeClass = {
|
||||||
|
small: 'text-lg',
|
||||||
|
medium: 'text-2xl',
|
||||||
|
large: 'text-3xl'
|
||||||
|
};
|
||||||
|
const spacingClass = {
|
||||||
|
none: 'mb-0',
|
||||||
|
small: 'mb-2',
|
||||||
|
medium: 'mb-4',
|
||||||
|
large: 'mb-6'
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<h2 class={`${sizeClass[size]} ${spacingClass[spacing]} font-semibold text-white`}>
|
||||||
|
{@render children()}
|
||||||
|
</h2>
|
||||||
Reference in New Issue
Block a user