-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
589efa6
commit c748913
Showing
6 changed files
with
95 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<script lang="ts"> | ||
import { type Variant, badgeVariants } from "./index.js"; | ||
import { cn } from "$lib/utils.js"; | ||
let className: string | undefined | null = undefined; | ||
export let href: string | undefined = undefined; | ||
export let variant: Variant = "default"; | ||
export { className as class }; | ||
</script> | ||
|
||
<svelte:element | ||
this={href ? "a" : "span"} | ||
{href} | ||
class={cn(badgeVariants({ variant, className }))} | ||
{...$$restProps} | ||
> | ||
<slot /> | ||
</svelte:element> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { type VariantProps, tv } from "tailwind-variants"; | ||
|
||
export { default as Badge } from "./badge.svelte"; | ||
export const badgeVariants = tv({ | ||
base: "focus:ring-ring inline-flex select-none items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2", | ||
variants: { | ||
variant: { | ||
default: | ||
"bg-primary text-primary-foreground hover:bg-primary/80 border-transparent shadow", | ||
secondary: | ||
"bg-secondary text-secondary-foreground hover:bg-secondary/80 border-transparent", | ||
destructive: | ||
"bg-destructive text-destructive-foreground hover:bg-destructive/80 border-transparent shadow", | ||
outline: "text-foreground", | ||
}, | ||
}, | ||
defaultVariants: { | ||
variant: "default", | ||
}, | ||
}); | ||
|
||
export type Variant = VariantProps<typeof badgeVariants>["variant"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<script lang="ts"> | ||
import Sun from 'lucide-svelte/icons/sun'; | ||
import Moon from 'lucide-svelte/icons/moon'; | ||
import { toggleMode } from 'mode-watcher'; | ||
import { Button } from '$lib/components/ui/button/index.js'; | ||
</script> | ||
|
||
<Button on:click={toggleMode} variant="outline" size="icon"> | ||
<Sun | ||
class="h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" | ||
/> | ||
<Moon | ||
class="absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" | ||
/> | ||
<span class="sr-only">Toggle theme</span> | ||
</Button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters