new view and components

This commit is contained in:
2025-09-03 20:41:25 -04:00
parent 685c92a82f
commit 2da630c8a8
29 changed files with 680 additions and 203 deletions
+38
View File
@@ -0,0 +1,38 @@
"use client";
import { useState, ReactNode } from "react";
interface ToggleOption {
key: string;
label: string;
content: ReactNode;
}
interface ToggleProps {
options: ToggleOption[];
defaultView?: string;
}
export default function Toggle({ options, defaultView }: ToggleProps) {
const [view, setView] = useState(defaultView || options[0].key);
return (
<section className="toggleSection">
<div className="toggleGroup">
{options.map((opt) => (
<button
key={opt.key}
className={`toggleButton ${view === opt.key ? "active" : ""}`}
onClick={() => setView(opt.key)}
>
{opt.label}
</button>
))}
</div>
<div className="padding">
{options.find((opt) => opt.key === view)?.content}
</div>
</section>
);
}