import { useState } from "react";
import Aliases from "@/components/dotfiles/Aliases";
import Vars from "@/components/dotfiles/Vars";
enum Section {
Aliases,
Vars,
Snippets,
}
function renderDotfiles(current: Section) {
switch (current) {
case Section.Aliases:
return ;
case Section.Vars:
return ;
case Section.Snippets:
return
;
}
}
interface HeaderProps {
current: Section;
setCurrent: (section: Section) => void;
}
interface TabsProps {
current: Section;
setCurrent: (section: Section) => void;
}
function Header({ current, setCurrent }: HeaderProps) {
return (
);
}
function classNames(...classes: any[]) {
return classes.filter(Boolean).join(" ");
}
function Tabs({ current, setCurrent }: TabsProps) {
let tabs = [
{
name: "Aliases",
isCurrent: () => current === Section.Aliases,
section: Section.Aliases,
},
{
name: "Vars",
isCurrent: () => current === Section.Vars,
section: Section.Vars,
},
{
name: "Snippets",
isCurrent: () => current === Section.Snippets,
section: Section.Snippets,
},
];
return (
{tabs.map((tab) => (
{
setCurrent(tab.section);
}}
key={tab.name}
className={classNames(
tab.isCurrent()
? "bg-gray-100 text-gray-700"
: "text-gray-500 hover:text-gray-700",
"rounded-md px-3 py-2 text-sm font-medium",
)}
aria-current={tab.isCurrent() ? "page" : undefined}
>
{tab.name}
))}
);
}
export default function Dotfiles() {
let [current, setCurrent] = useState(Section.Aliases);
console.log(current);
return (
Manage your shell aliases, variables and paths
{renderDotfiles(current)}
);
}