added Station Add, Delete Update
This commit is contained in:
52
apps/hub/app/_components/ui/Input.tsx
Normal file
52
apps/hub/app/_components/ui/Input.tsx
Normal file
@@ -0,0 +1,52 @@
|
||||
import React from 'react';
|
||||
import {
|
||||
FieldValues,
|
||||
Path,
|
||||
RegisterOptions,
|
||||
UseFormReturn,
|
||||
} from 'react-hook-form';
|
||||
import { cn } from '../../../helper/cn';
|
||||
|
||||
interface InputProps<T extends FieldValues>
|
||||
extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'form'> {
|
||||
name: Path<T>;
|
||||
form: UseFormReturn<T>;
|
||||
formOptions?: RegisterOptions<T>;
|
||||
label?: string;
|
||||
placeholder?: string;
|
||||
}
|
||||
|
||||
export const Input = <T extends FieldValues>({
|
||||
name,
|
||||
label = name,
|
||||
placeholder = label,
|
||||
form,
|
||||
formOptions,
|
||||
className,
|
||||
...inputProps
|
||||
}: InputProps<T>) => {
|
||||
return (
|
||||
<label className="form-control w-full">
|
||||
<div className="label">
|
||||
<span className="label-text text-lg flex items-center gap-2">
|
||||
{label}
|
||||
</span>
|
||||
</div>
|
||||
<input
|
||||
{...form.register(name, formOptions)}
|
||||
type="text"
|
||||
className={cn(
|
||||
'input input-bordered w-full placeholder:text-neutral-600',
|
||||
className
|
||||
)}
|
||||
placeholder={placeholder}
|
||||
{...inputProps}
|
||||
/>
|
||||
{form.formState.errors[name] && (
|
||||
<p className="text-error">
|
||||
{form.formState.errors[name].message as string}
|
||||
</p>
|
||||
)}
|
||||
</label>
|
||||
);
|
||||
};
|
||||
8
apps/hub/app/_components/ui/Loading.tsx
Normal file
8
apps/hub/app/_components/ui/Loading.tsx
Normal file
@@ -0,0 +1,8 @@
|
||||
export const Loading = () => {
|
||||
return (
|
||||
<div className="flex items-center justify-center h-full">
|
||||
<div className="spinner"></div>
|
||||
<p>LAAAADEN</p>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -29,7 +29,10 @@ export const VerticalNav = () => {
|
||||
</summary>
|
||||
<ul>
|
||||
<li>
|
||||
<Link href="/admin/user">User</Link>
|
||||
<Link href="/admin/user">Benutzer</Link>
|
||||
</li>
|
||||
<li>
|
||||
<Link href="/admin/station">Stationen</Link>
|
||||
</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
Reference in New Issue
Block a user