import { Link, useLocation } from "react-router";
import clsx from "clsx";
import { ReactNode } from "react";
import { useTranslation } from "react-i18next";
import Tabs from "../tabs/Tabs";
export default function SettingsLayout({
items,
children,
}: {
items: { name: string; description: string; routePath: string; icon: ReactNode }[];
children: ReactNode;
}) {
const { t } = useTranslation();
return (
{/* Breadcrumb */}
{/* Secondary sidebar */}
{children}
);
}
function SubNavigation({
items,
}: {
items: {
name: string;
description: string;
routePath: string;
icon: ReactNode;
}[];
}) {
const location = useLocation();
function isCurrent(idx: number) {
return currentTab() === items[idx];
}
const currentTab = () => {
return items.find((element) => element.routePath && (location.pathname + location.search).includes(element.routePath));
};
return (
<>
{items.map((item, idx) => (
{item.icon}
{item.name}
{item.description}
))}
>
);
}