import { useState } from 'react'; import { ExternalLinkIcon, MonitorSmartphoneIcon } from 'lucide-react'; import { Button } from '../../components/ui/button'; import { Callout } from '../../components/ui/callout'; import { Tabs, TabsList, TabsTrigger } from '../../components/ui/tabs'; import type { ISeoSettings } from '../../service/seo/seo.interface'; /** * The plugin's front-end pieces rendered by the theme: a page of the site * loads in a frame with its content swapped for one piece, so what shows * is exactly what a visitor gets, custom CSS included. Nothing here is * drawn by the admin app. */ const SeoFrontendPreview = ({ preview, }: { preview: ISeoSettings['preview']; }): JSX.Element => { const [piece, setPiece] = useState(preview.pieces[0]?.key ?? ''); const current = preview.pieces.find(item => item.key === piece); if (!preview.page || !current) { return ( Nothing to preview yet: publish a page or a post first, and the preview loads it with the piece in place of its content. ); } return (
setPiece(String(next))}> {preview.pieces.map(item => ( {item.label} ))}

{current.shortcode} {' '} as the theme prints it, in place of the content of “ {preview.page.title}”. {!current.available && ' Its module is off, so the frame says so instead of showing it.'}

{preview.page.url}