Add web frontend
This commit is contained in:
33
web/src/components/ui/button.tsx
Normal file
33
web/src/components/ui/button.tsx
Normal file
@@ -0,0 +1,33 @@
|
||||
import { cva, type VariantProps } from "class-variance-authority";
|
||||
import type { JSX } from "preact";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const buttonVariants = cva(
|
||||
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors disabled:pointer-events-none disabled:opacity-50 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
|
||||
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
||||
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
||||
ghost: "hover:bg-accent hover:text-accent-foreground",
|
||||
},
|
||||
size: {
|
||||
default: "h-10 px-4 py-2",
|
||||
sm: "h-8 rounded-md px-3 text-xs",
|
||||
lg: "h-11 rounded-md px-8",
|
||||
icon: "h-9 w-9",
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: "default",
|
||||
size: "default",
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
type ButtonProps = JSX.ButtonHTMLAttributes<HTMLButtonElement> & VariantProps<typeof buttonVariants>;
|
||||
|
||||
export function Button({ className, variant, size, ...props }: ButtonProps) {
|
||||
return <button className={cn(buttonVariants({ variant, size }), className)} {...props} />;
|
||||
}
|
||||
14
web/src/components/ui/input.tsx
Normal file
14
web/src/components/ui/input.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import type { JSX } from "preact";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export function Input({ className, ...props }: JSX.InputHTMLAttributes<HTMLInputElement>) {
|
||||
return (
|
||||
<input
|
||||
className={cn(
|
||||
"flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
11
web/src/components/ui/scroll-area.tsx
Normal file
11
web/src/components/ui/scroll-area.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
import type { ComponentChildren } from "preact";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
type ScrollAreaProps = {
|
||||
className?: string;
|
||||
children: ComponentChildren;
|
||||
};
|
||||
|
||||
export function ScrollArea({ className, children }: ScrollAreaProps) {
|
||||
return <div className={cn("overflow-y-auto", className)}>{children}</div>;
|
||||
}
|
||||
9
web/src/components/ui/separator.tsx
Normal file
9
web/src/components/ui/separator.tsx
Normal file
@@ -0,0 +1,9 @@
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
type SeparatorProps = {
|
||||
className?: string;
|
||||
};
|
||||
|
||||
export function Separator({ className }: SeparatorProps) {
|
||||
return <div className={cn("h-px w-full bg-border", className)} />;
|
||||
}
|
||||
14
web/src/components/ui/textarea.tsx
Normal file
14
web/src/components/ui/textarea.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import type { JSX } from "preact";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export function Textarea({ className, ...props }: JSX.TextareaHTMLAttributes<HTMLTextAreaElement>) {
|
||||
return (
|
||||
<textarea
|
||||
className={cn(
|
||||
"flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user