Initial commit
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
"use client";
|
||||
|
||||
import { useState, useEffect, type ComponentPropsWithoutRef } from "react";
|
||||
import { CookieConsentBanner } from "./cookie-consent-banner";
|
||||
|
||||
export type CookieConsentBannerLoaderProps = ComponentPropsWithoutRef<
|
||||
typeof CookieConsentBanner
|
||||
>;
|
||||
|
||||
/**
|
||||
* SSR-safe wrapper that renders null on the server and mounts
|
||||
* <CookieConsentBanner> client-side only (after hydration).
|
||||
*/
|
||||
export function CookieConsentBannerLoader(
|
||||
props: CookieConsentBannerLoaderProps,
|
||||
) {
|
||||
const [mounted, setMounted] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
setMounted(true);
|
||||
}, []);
|
||||
|
||||
if (!mounted) return null;
|
||||
|
||||
return <CookieConsentBanner {...props} />;
|
||||
}
|
||||
Reference in New Issue
Block a user