Skip to content

Commit

Permalink
Add louper-cli banner
Browse files Browse the repository at this point in the history
  • Loading branch information
ezynda3 committed Mar 14, 2024
1 parent e90c0b2 commit b889c30
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/lib/components/ui/alert/alert-description.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<script lang="ts">
import { cn } from "$lib/utils.js";
import type { HTMLAttributes } from "svelte/elements";
type $$Props = HTMLAttributes<HTMLDivElement>;
let className: $$Props["class"] = undefined;
export { className as class };
</script>

<div class={cn("text-sm [&_p]:leading-relaxed", className)} {...$$restProps}>
<slot />
</div>
21 changes: 21 additions & 0 deletions src/lib/components/ui/alert/alert-title.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<script lang="ts">
import { cn } from "$lib/utils.js";
import type { HTMLAttributes } from "svelte/elements";
import type { HeadingLevel } from "./index.js";
type $$Props = HTMLAttributes<HTMLHeadingElement> & {
level?: HeadingLevel;
};
let className: $$Props["class"] = undefined;
export let level: $$Props["level"] = "h5";
export { className as class };
</script>

<svelte:element
this={level}
class={cn("mb-1 font-medium leading-none tracking-tight", className)}
{...$$restProps}
>
<slot />
</svelte:element>
17 changes: 17 additions & 0 deletions src/lib/components/ui/alert/alert.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<script lang="ts">
import { cn } from "$lib/utils.js";
import type { HTMLAttributes } from "svelte/elements";
import { alertVariants, type Variant } from "./index.js";
type $$Props = HTMLAttributes<HTMLDivElement> & {
variant?: Variant;
};
let className: $$Props["class"] = undefined;
export let variant: $$Props["variant"] = "default";
export { className as class };
</script>

<div class={cn(alertVariants({ variant }), className)} {...$$restProps} role="alert">
<slot />
</div>
32 changes: 32 additions & 0 deletions src/lib/components/ui/alert/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { tv, type VariantProps } from "tailwind-variants";

import Root from "./alert.svelte";
import Description from "./alert-description.svelte";
import Title from "./alert-title.svelte";

export const alertVariants = tv({
base: "relative w-full rounded-lg border px-4 py-3 text-sm [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",
variants: {
variant: {
default: "bg-background text-foreground",
destructive:
"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",
},
},
defaultVariants: {
variant: "default",
},
});

export type Variant = VariantProps<typeof alertVariants>["variant"];
export type HeadingLevel = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";

export {
Root,
Description,
Title,
//
Root as Alert,
Description as AlertDescription,
Title as AlertTitle,
};
13 changes: 12 additions & 1 deletion src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import { tick } from 'svelte'
import { cn } from '$lib/utils'
import { Button } from '$lib/components/ui/button'
import * as Alert from '$lib/components/ui/alert'
import Terminal from 'lucide-svelte/icons/terminal'
let network: string | undefined
let address: Address | undefined
Expand Down Expand Up @@ -64,7 +66,16 @@
</nav>
</div>

<div class="container pt-20">
<div class="pt-20 container max-w-2xl">
<Alert.Root class="p-5">
<Terminal class="h-8 w-8" />
<Alert.Title class="ml-2 text-xl">Try Louper CLI!</Alert.Title>
<Alert.Description class="ml-2 font-mono text-opacity-25 before:content-['$']">
&nbsp;npm install -g @mark3labs/louper-cli@latest
</Alert.Description>
</Alert.Root>
</div>
<div class="container pt-10">
<div class="my-24 rounded-[0.5rem] border shadow-sm shadow-primary">
<div class="border-b">
<div class="flex h-16 items-center p-5">
Expand Down

0 comments on commit b889c30

Please # to comment.