Files
webshop/shop/components/HeaderWrapper.tsx
DanielS fe1d15090a
All checks were successful
Staging Build / build (push) Successful in 2m36s
feat: hide all demo badges when demo mode is disabled
2026-06-24 13:19:00 +02:00

39 lines
1.0 KiB
TypeScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"use client";
import { usePathname } from "next/navigation";
import { DemoWrapper } from "./DemoWrapper";
interface HeaderWrapperProps {
navbar: React.ReactNode;
children: React.ReactNode;
}
export function HeaderWrapper({ navbar, children }: HeaderWrapperProps) {
const pathname = usePathname();
const isAdmin = pathname?.startsWith("/admin");
if (isAdmin) {
return <>{children}</>;
}
return (
<div className="flex flex-col min-h-screen bg-slate-50 text-slate-900 dark:bg-[#020617] dark:text-white">
{/* Demo Banner */}
<DemoWrapper>
<div
id="demo-banner"
className="bg-amber-500/10 border-b border-amber-500/20 py-2 px-4 text-center text-xs text-amber-600 dark:text-amber-400 font-medium tracking-wide z-50"
>
Dies ist eine **Demo-Webseite (Dummy-Shop)**. Es werden keine echten Bestellungen verarbeitet oder Zahlungen abgewickelt.
</div>
</DemoWrapper>
{navbar}
<main className="flex-1">
{children}
</main>
</div>
);
}