Files
supabase/apps/www/components/Blog/DraftModeBanner.tsx
Francesco Sansalvadore 2feda5ee19 cms www blog (#38045)
* show cms blog posts in www
* remove contentlayer from www
* outputFileTracingExcludes
* update remotePatterns
* fetch cms posts server-side with revalidation
* add cms env vars to turbo.json
* add www env vars to turbo.json
* include cms posts in www sitemap
* add migration to remove image from cms post
* update cms meta image mapping in www
2025-09-03 14:49:28 +02:00

54 lines
1.8 KiB
TypeScript

import { AlertTriangle, X } from 'lucide-react'
import Link from 'next/link'
import { Button } from 'ui'
interface DraftModeBannerProps {
onDismiss?: () => void
}
function DraftModeBanner({ onDismiss }: DraftModeBannerProps) {
return (
<div className="fixed inset-0 top-auto z-40 bg-surface-400 border-t">
<div className="max-w-2xl mx-auto py-2 px-4">
<div className="flex items-center justify-between flex-wrap">
<div className="w-0 flex-1 flex items-center">
<span className="flex p-2 rounded">
<AlertTriangle className="h-5 w-5" aria-hidden="true" />
</span>
<p className="ml-2 truncate">
<span className="md:hidden">You're viewing draft content</span>
<span className="hidden md:inline">
You're viewing draft content that may not be published yet.
</span>
</p>
</div>
<div className="order-3 mt-2 flex-shrink-0 w-full sm:order-2 sm:mt-0 sm:w-auto">
<Button asChild type="secondary">
<Link
href="/api-v2/cms/disable-draft"
className="flex items-center justify-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm"
>
Exit Draft Mode
</Link>
</Button>
</div>
{onDismiss && (
<div className="order-2 flex-shrink-0 sm:order-3 sm:ml-3">
<button
type="button"
className="-mr-1 flex p-2 rounded-md sm:-mr-2"
onClick={onDismiss}
>
<span className="sr-only">Dismiss</span>
<X className="h-5 w-5" aria-hidden="true" />
</button>
</div>
)}
</div>
</div>
</div>
)
}
export default DraftModeBanner