inerito SignOuitButton

This commit is contained in:
AV77web 2026-05-27 16:10:53 +02:00
parent 2de9d601f5
commit b006ac7f00
2 changed files with 16 additions and 6 deletions

View file

@ -1,5 +1,7 @@
import type { Metadata } from "next";
import { Inter, JetBrains_Mono } from "next/font/google";
import { auth } from "@/src/auth";
import SignOutButton from "@/src/components/auth/SignOutButton";
import Navbar from "../components/Navbar";
import "./globals.css";
@ -19,18 +21,20 @@ export const metadata: Metadata = {
description: "Generated by create next app",
};
export default function RootLayout({
export default async function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
const session = await auth();
return (
<html lang="en">
<body className={`${geistSans.variable} ${geistMono.variable} h-full antialiased`}>
<p className="bg-purple-700 text-white w-full text-center py-2">
Sono del layout root
</p>
<Navbar />
<Navbar actions={session?.user ? <SignOutButton /> : null} />
{children}
</body>
</html>

View file

@ -5,7 +5,7 @@
// @version: "1.0.0 2026-05-07"
//====================================
"use client"
import { useState , MouseEvent} from "react";
import { useState , MouseEvent, ReactNode} from "react";
import Link from "next/link";
interface NavLink {
@ -34,7 +34,7 @@ const serviceLinks: ServiceLink[] = [
]
export default function Navbar() {
export default function Navbar({ actions }: { actions?: ReactNode }) {
const [ isServicesOpen, setIsServicesOpen] = useState<boolean>(false);
@ -56,7 +56,7 @@ export default function Navbar() {
</Link>
{/* Navigation */}
<div className="flex space-x-8">
<div className="flex items-center space-x-8">
{/* Link normali */}
{navLinks.map((link) => (
@ -117,8 +117,14 @@ export default function Navbar() {
</div>
</div>
{actions ? (
<div className="flex items-center">
{actions}
</div>
) : null}
</div>
</div>
</nav>
);
}
}