Initial commit: spreewaldzeit + Dockerfile for Coolify (Next.js + Prisma/SQLite)
This commit is contained in:
43
components/ui/Button.tsx
Normal file
43
components/ui/Button.tsx
Normal file
@@ -0,0 +1,43 @@
|
||||
import { cn } from "@/lib/utils";
|
||||
import { forwardRef, type ButtonHTMLAttributes } from "react";
|
||||
|
||||
type Variant = "primary" | "secondary" | "ghost" | "outline";
|
||||
type Size = "sm" | "md" | "lg";
|
||||
|
||||
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
||||
variant?: Variant;
|
||||
size?: Size;
|
||||
}
|
||||
|
||||
const variantClasses: Record<Variant, string> = {
|
||||
primary:
|
||||
"bg-ink text-parchment hover:bg-moss-700 disabled:bg-ink/40",
|
||||
secondary:
|
||||
"bg-moss-500 text-parchment hover:bg-moss-600 disabled:bg-moss-500/40",
|
||||
outline:
|
||||
"border border-ink/20 text-ink hover:border-ink/40 hover:bg-ink/5",
|
||||
ghost:
|
||||
"text-ink hover:bg-ink/5",
|
||||
};
|
||||
|
||||
const sizeClasses: Record<Size, string> = {
|
||||
sm: "px-3.5 py-2 text-xs",
|
||||
md: "px-5 py-2.5 text-sm",
|
||||
lg: "px-7 py-3.5 text-base",
|
||||
};
|
||||
|
||||
export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
||||
({ className, variant = "primary", size = "md", ...props }, ref) => (
|
||||
<button
|
||||
ref={ref}
|
||||
className={cn(
|
||||
"inline-flex items-center justify-center gap-2 rounded-full font-medium transition-colors disabled:cursor-not-allowed",
|
||||
variantClasses[variant],
|
||||
sizeClasses[size],
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
Button.displayName = "Button";
|
||||
80
components/ui/Input.tsx
Normal file
80
components/ui/Input.tsx
Normal file
@@ -0,0 +1,80 @@
|
||||
import { cn } from "@/lib/utils";
|
||||
import { forwardRef, type InputHTMLAttributes, type TextareaHTMLAttributes, type LabelHTMLAttributes } from "react";
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// Label
|
||||
// -----------------------------------------------------------------
|
||||
export function Label({
|
||||
className,
|
||||
...props
|
||||
}: LabelHTMLAttributes<HTMLLabelElement>) {
|
||||
return (
|
||||
<label
|
||||
className={cn(
|
||||
"text-xs uppercase tracking-[0.18em] text-ink/70 font-medium",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// Input
|
||||
// -----------------------------------------------------------------
|
||||
interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export const Input = forwardRef<HTMLInputElement, InputProps>(
|
||||
({ className, error, ...props }, ref) => (
|
||||
<input
|
||||
ref={ref}
|
||||
className={cn(
|
||||
"w-full bg-transparent border-b py-2.5 text-base",
|
||||
"placeholder:text-ink/40 focus:outline-none",
|
||||
error
|
||||
? "border-red-600 focus:border-red-700"
|
||||
: "border-ink/25 focus:border-ink",
|
||||
"transition-colors",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
Input.displayName = "Input";
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// Textarea
|
||||
// -----------------------------------------------------------------
|
||||
interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
|
||||
({ className, error, ...props }, ref) => (
|
||||
<textarea
|
||||
ref={ref}
|
||||
className={cn(
|
||||
"w-full bg-transparent border py-3 px-3 text-base rounded-md",
|
||||
"placeholder:text-ink/40 focus:outline-none resize-y min-h-[120px]",
|
||||
error
|
||||
? "border-red-600 focus:border-red-700"
|
||||
: "border-ink/25 focus:border-ink",
|
||||
"transition-colors",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
Textarea.displayName = "Textarea";
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// FieldError – ein einheitlicher Fehler-Text
|
||||
// -----------------------------------------------------------------
|
||||
export function FieldError({ message }: { message?: string }) {
|
||||
if (!message) return null;
|
||||
return <p className="mt-1.5 text-xs text-red-700">{message}</p>;
|
||||
}
|
||||
Reference in New Issue
Block a user