Skip to content

Commit

Permalink
cards and stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
d3rpp committed Aug 16, 2024
1 parent 87f72fb commit 48a45d9
Show file tree
Hide file tree
Showing 8 changed files with 142 additions and 2 deletions.
17 changes: 17 additions & 0 deletions src/lib/components/ui/card/card-content.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<script lang="ts">
import type { HTMLAttributes } from "svelte/elements";
import { cn } from "$lib/utils.js";
const {
class: className,
children,
...rest
}: HTMLAttributes<HTMLDivElement> = $props();
</script>

<div class={cn("p-6 pt-0", className)} {...rest}>
{#if children}
{@render children()}
{/if}
</div>
17 changes: 17 additions & 0 deletions src/lib/components/ui/card/card-description.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<script lang="ts">
import type { HTMLAttributes } from "svelte/elements";
import { cn } from "$lib/utils.js";
const {
class: className,
children,
...rest
}: HTMLAttributes<HTMLParagraphElement> = $props();
</script>

<p class={cn("text-sm text-muted-foreground", className)} {...rest}>
{#if children}
{@render children()}
{/if}
</p>
17 changes: 17 additions & 0 deletions src/lib/components/ui/card/card-footer.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<script lang="ts">
import type { HTMLAttributes } from "svelte/elements";
import { cn } from "$lib/utils.js";
const {
class: className,
children,
...rest
}: HTMLAttributes<HTMLDivElement> = $props();
</script>

<div class={cn("flex items-center p-6 pt-0", className)} {...rest}>
{#if children}
{@render children()}
{/if}
</div>
17 changes: 17 additions & 0 deletions src/lib/components/ui/card/card-header.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<script lang="ts">
import type { HTMLAttributes } from "svelte/elements";
import { cn } from "$lib/utils.js";
const {
class: className,
children,
...rest
}: HTMLAttributes<HTMLDivElement> = $props();
</script>

<div class={cn("flex flex-col space-y-1.5 p-6", className)} {...rest}>
{#if children}
{@render children()}
{/if}
</div>
25 changes: 25 additions & 0 deletions src/lib/components/ui/card/card-title.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<script lang="ts">
import type { HTMLAttributes } from "svelte/elements";
import type { HeadingLevel } from "./index.js";
import { cn } from "$lib/utils.js";
const {
class: className = undefined,
tag = "h3",
children,
...rest
}: HTMLAttributes<HTMLHeadingElement> & {
tag?: HeadingLevel;
} = $props();
</script>

<svelte:element
this={tag}
class={cn("text-lg font-semibold leading-none tracking-tight", className)}
{...rest}
>
{#if children}
{@render children()}
{/if}
</svelte:element>
23 changes: 23 additions & 0 deletions src/lib/components/ui/card/card.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<script lang="ts">
import type { HTMLAttributes } from "svelte/elements";
import { cn } from "$lib/utils.js";
const {
class: className,
children,
...rest
}: HTMLAttributes<HTMLDivElement> = $props();
</script>

<div
class={cn(
"rounded-lg border bg-card text-card-foreground shadow-sm",
className,
)}
{...rest}
>
{#if children}
{@render children()}
{/if}
</div>
24 changes: 24 additions & 0 deletions src/lib/components/ui/card/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import Root from "./card.svelte";
import Content from "./card-content.svelte";
import Description from "./card-description.svelte";
import Footer from "./card-footer.svelte";
import Header from "./card-header.svelte";
import Title from "./card-title.svelte";

export {
Root,
Content,
Description,
Footer,
Header,
Title,
//
Root as Card,
Content as CardContent,
Description as CardDescription,
Footer as CardFooter,
Header as CardHeader,
Title as CardTitle,
};

export type HeadingLevel = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
4 changes: 2 additions & 2 deletions src/routes/(auth)/signup/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
const username = writable({ username: "" });
const query = rpc.auth.check_username_availability.createQuery($username);
const query = rpc.auth.check_username_availability.createQuery(username);
</script>

<input
type="text"
oninput={debounce((ev) => {
ev.preventDefault();
if (!(ev.target instanceof HTMLInputElement)) return;
username.set({username: ev.target.value});
username.set({ username: ev.target.value });
utils.auth.check_username_availability.invalidate();
}, 500)}
/>
Expand Down

0 comments on commit 48a45d9

Please sign in to comment.