cal.pub0.org/components/Settings.tsx

71 lines
2.2 KiB
TypeScript
Raw Normal View History

2021-08-02 17:29:34 +00:00
import Link from "next/link";
2021-07-30 23:05:38 +00:00
import { CreditCardIcon, UserIcon, CodeIcon, KeyIcon, UserGroupIcon } from "@heroicons/react/solid";
import { useRouter } from "next/router";
2021-04-07 15:03:02 +00:00
2021-07-30 23:05:38 +00:00
function classNames(...classes) {
return classes.filter(Boolean).join(" ");
}
2021-06-16 12:42:30 +00:00
2021-07-30 23:05:38 +00:00
export default function SettingsShell(props) {
const router = useRouter();
2021-04-07 15:03:02 +00:00
2021-07-30 23:05:38 +00:00
const tabs = [
2021-08-02 17:29:34 +00:00
{
name: "Profile",
href: "/settings/profile",
icon: UserIcon,
current: router.pathname == "/settings/profile",
},
{
name: "Password",
href: "/settings/password",
icon: KeyIcon,
current: router.pathname == "/settings/password",
},
2021-07-30 23:05:38 +00:00
{ name: "Embed", href: "/settings/embed", icon: CodeIcon, current: router.pathname == "/settings/embed" },
2021-08-02 17:29:34 +00:00
{
name: "Teams",
href: "/settings/teams",
icon: UserGroupIcon,
current: router.pathname == "/settings/teams",
},
{
name: "Billing",
href: "/settings/billing",
icon: CreditCardIcon,
current: router.pathname == "/settings/billing",
},
2021-07-30 23:05:38 +00:00
];
2021-04-07 15:03:02 +00:00
2021-07-30 23:05:38 +00:00
return (
<div className="max-w-6xl">
2021-08-02 21:25:37 +00:00
<div className="sm:mx-auto -mx-4">
<nav className="-mb-px flex space-x-2 sm:space-x-8 px-4 sm:px-0 " aria-label="Tabs">
2021-08-02 17:29:34 +00:00
{tabs.map((tab) => (
<Link key={tab.name} href={tab.href}>
<a
className={classNames(
tab.current
? "border-neutral-900 text-neutral-900"
: "border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300",
"group inline-flex items-center py-4 px-1 border-b-2 font-medium text-sm"
)}
aria-current={tab.current ? "page" : undefined}>
<tab.icon
className={classNames(
tab.current ? "text-neutral-900" : "text-gray-400 group-hover:text-gray-500",
2021-08-02 21:25:37 +00:00
"-ml-0.5 mr-2 h-5 w-5 hidden sm:inline-block"
2021-08-02 17:29:34 +00:00
)}
aria-hidden="true"
/>
<span>{tab.name}</span>
</a>
</Link>
))}
</nav>
2021-07-30 23:05:38 +00:00
</div>
<main>{props.children}</main>
</div>
);
}