Skip to content

Commit

Permalink
feat: Add text component (#29)
Browse files Browse the repository at this point in the history
The text component ensures consistent styling throughout
the application.
  • Loading branch information
maalni authored Jan 18, 2024
1 parent 67a9885 commit 6e87215
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lib/components/typography/Blockquote.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<blockquote class="mt-6 border-l-2 pl-6 italic">
<slot />
</blockquote>
3 changes: 3 additions & 0 deletions src/lib/components/typography/H1.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<h1 class="scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl">
<slot />
</h1>
5 changes: 5 additions & 0 deletions src/lib/components/typography/H2.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<h2
class="scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight transition-colors first:mt-0"
>
<slot />
</h2>
3 changes: 3 additions & 0 deletions src/lib/components/typography/H3.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<h3 class="scroll-m-20 text-2xl font-semibold tracking-tight">
<slot />
</h3>
3 changes: 3 additions & 0 deletions src/lib/components/typography/H4.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<h4 class="scroll-m-20 text-xl font-semibold tracking-tight">
<slot />
</h4>
3 changes: 3 additions & 0 deletions src/lib/components/typography/Large.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="text-lg font-semibold">
<slot />
</div>
3 changes: 3 additions & 0 deletions src/lib/components/typography/Lead.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<p class="text-xl text-muted-foreground">
<slot />
</p>
3 changes: 3 additions & 0 deletions src/lib/components/typography/Muted.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<p class="text-sm text-muted-foreground">
<slot />
</p>
3 changes: 3 additions & 0 deletions src/lib/components/typography/P.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<p class="leading-7 [&:not(:first-child)]:mt-6">
<slot />
</p>
3 changes: 3 additions & 0 deletions src/lib/components/typography/Small.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<small class="text-sm font-medium leading-none">
<slot />
</small>
31 changes: 31 additions & 0 deletions src/lib/components/typography/Text.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<script lang="ts">
import Blockquote from '$lib/components/typography/Blockquote.svelte';
import H1 from '$lib/components/typography/H1.svelte';
import H2 from '$lib/components/typography/H2.svelte';
import H3 from '$lib/components/typography/H3.svelte';
import H4 from '$lib/components/typography/H4.svelte';
import Lead from '$lib/components/typography/Lead.svelte';
import Large from '$lib/components/typography/Large.svelte';
import Muted from '$lib/components/typography/Muted.svelte';
import P from '$lib/components/typography/P.svelte';
import Small from '$lib/components/typography/Small.svelte';
const textMapping = {
blockquote: Blockquote,
h1: H1,
h2: H2,
h3: H3,
h4: H4,
lead: Lead,
large: Large,
muted: Muted,
p: P,
small: Small
};
export let type: keyof typeof textMapping;
</script>

<svelte:component this={textMapping[type]}>
<slot />
</svelte:component>

0 comments on commit 6e87215

Please sign in to comment.