'use client'; import { X } from 'lucide-react'; import { useEffect, useState } from 'react'; import { Button } from '@/components/ui/button'; import { cn } from '@/lib/utils'; const Banner = ({ url = 'https://shadcnblocks.com' }: { url?: string }) => { const [isVisible, setIsVisible] = useState(true); const [isClient, setIsClient] = useState(false); // Check localStorage to see if banner was previously dismissed useEffect(() => { queueMicrotask(() => { setIsClient(true); const bannerDismissed = localStorage.getItem('banner-dismissed'); if (bannerDismissed === 'true') { setIsVisible(false); } }); }, []); const handleDismiss = () => { setIsVisible(false); localStorage.setItem('banner-dismissed', 'true'); }; // Don't render anything until client-side hydration is complete if (!isClient || !isVisible) { return null; } return (
Purchase this theme on{' '} shadcnblocks.com
); }; export default Banner;