page titles and nav

This commit is contained in:
Timur Ercan
2023-01-04 16:28:32 +01:00
parent 963c73ff14
commit 95b0696e71
5 changed files with 30 additions and 5 deletions

View File

@ -24,7 +24,7 @@ const navigation = [
{ name: "Settings", href: "/settings", current: true },
];
const userNavigation = [
{ name: "Your Profile", href: "/settings" },
{ name: "Your Profile", href: "/settings/profile" },
{
name: "Sign out",
href: "",
@ -42,7 +42,7 @@ function classNames(...classes: any) {
export default function Layout({ children }: any) {
const router = useRouter();
navigation.forEach((element) => {
element.current = router.route.startsWith(element.href);
element.current = router.route.startsWith("/" + element.href.split("/")[1]);
});
return (

View File

@ -14,6 +14,7 @@ import {
} from "@heroicons/react/24/outline";
import { useRouter } from "next/router";
import Link from "next/link";
import Head from "next/head";
const user = {
name: "Debbie Lewis",
@ -56,13 +57,15 @@ export default function Setttings() {
const router = useRouter();
console.log(router.route);
subNavigation.forEach((element) => {
element.current = element.href == router.route;
});
return (
<div>
<Head>
<title>Settings | Documenso</title>
</Head>
<header className="py-10">
<div className="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
<h1 className="text-3xl font-bold leading-tight tracking-tight text-brown">