-
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
a2919ca
commit 3825a83
Showing
6 changed files
with
99 additions
and
5 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
16 changes: 16 additions & 0 deletions
16
src/lib/components/primitives/alert/alert-description.svelte
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,16 @@ | ||
<script lang="ts"> | ||
import type { WithElementRef } from "bits-ui"; | ||
import type { HTMLAttributes } from "svelte/elements"; | ||
import { cn } from "$lib/utils.js"; | ||
let { | ||
ref = $bindable(null), | ||
class: className, | ||
children, | ||
...restProps | ||
}: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props(); | ||
</script> | ||
|
||
<div bind:this={ref} class={cn("text-sm [&_p]:leading-relaxed", className)} {...restProps}> | ||
{@render children?.()} | ||
</div> |
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,25 @@ | ||
<script lang="ts"> | ||
import type { HTMLAttributes } from "svelte/elements"; | ||
import type { WithElementRef } from "bits-ui"; | ||
import { cn } from "$lib/utils.js"; | ||
let { | ||
ref = $bindable(null), | ||
class: className, | ||
level = 5, | ||
children, | ||
...restProps | ||
}: WithElementRef<HTMLAttributes<HTMLDivElement>> & { | ||
level?: 1 | 2 | 3 | 4 | 5 | 6; | ||
} = $props(); | ||
</script> | ||
|
||
<div | ||
role="heading" | ||
aria-level={level} | ||
bind:this={ref} | ||
class={cn("mb-1 font-medium leading-none tracking-tight", className)} | ||
{...restProps} | ||
> | ||
{@render children?.()} | ||
</div> |
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,39 @@ | ||
<script lang="ts" module> | ||
import { type VariantProps, tv } from "tailwind-variants"; | ||
export const alertVariants = tv({ | ||
base: "[&>svg]:text-foreground relative w-full rounded-lg border p-4 [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg~*]:pl-7", | ||
variants: { | ||
variant: { | ||
default: "bg-background text-foreground", | ||
destructive: | ||
"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive", | ||
}, | ||
}, | ||
defaultVariants: { | ||
variant: "default", | ||
}, | ||
}); | ||
export type AlertVariant = VariantProps<typeof alertVariants>["variant"]; | ||
</script> | ||
|
||
<script lang="ts"> | ||
import type { HTMLAttributes } from "svelte/elements"; | ||
import type { WithElementRef } from "bits-ui"; | ||
import { cn } from "$lib/utils.js"; | ||
let { | ||
ref = $bindable(null), | ||
class: className, | ||
variant = "default", | ||
children, | ||
...restProps | ||
}: WithElementRef<HTMLAttributes<HTMLDivElement>> & { | ||
variant?: AlertVariant; | ||
} = $props(); | ||
</script> | ||
|
||
<div bind:this={ref} class={cn(alertVariants({ variant }), className)} {...restProps} role="alert"> | ||
{@render children?.()} | ||
</div> |
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,14 @@ | ||
import Root from "./alert.svelte"; | ||
import Description from "./alert-description.svelte"; | ||
import Title from "./alert-title.svelte"; | ||
export { alertVariants, type AlertVariant } from "./alert.svelte"; | ||
|
||
export { | ||
Root, | ||
Description, | ||
Title, | ||
// | ||
Root as Alert, | ||
Description as AlertDescription, | ||
Title as AlertTitle, | ||
}; |