base editor

This commit is contained in:
2026-09-06 22:41:55 -04:00
parent 04e66527ca
commit 4cf612758c
11 changed files with 932 additions and 31 deletions
+31
View File
@@ -0,0 +1,31 @@
type InputType = {
label: string;
forLabel: string;
type: "password" | "email" | "text";
dark?: boolean;
onChange?: (v: string) => void;
};
export default function Input({
label,
forLabel,
type,
dark = true,
onChange,
}: InputType) {
return (
<div className="space-y-1">
<label htmlFor={forLabel} className="text-sm block">
{label}
</label>
<input
id={forLabel}
onChange={onChange ? (e) => onChange(e.target.value) : undefined}
type={type}
required
name={forLabel}
className={`${dark ? "bg-black text-white" : "bg-white text-black"} rounded-lg border-white block`}
/>
</div>
);
}
+22 -7
View File
@@ -1,11 +1,26 @@
import type { ReactNode } from "react";
import Header from "./header";
import { useAuth } from "../providers/AuthProvider";
import { useNavigate } from "react-router-dom";
export default function Layout({ children }: { children: ReactNode }) {
return (
<div className="bg-black text-white min-h-screen w-full max-w-[42rem] 2xl:max-w-[48rem] mx-auto select-none px-5">
<Header />
<div className="relative">{children}</div>
</div>
);
export default function Layout({
children,
isProtected = false,
}: {
children: ReactNode;
isProtected?: boolean;
}) {
const auth = useAuth();
const navigate = useNavigate();
if (isProtected && !auth.user) {
navigate("/");
} else {
return (
<div className="bg-black text-white min-h-screen w-full max-w-[42rem] 2xl:max-w-[48rem] mx-auto select-none px-5">
<Header />
<div className="relative">{children}</div>
</div>
);
}
}