import type { SourceId } from '@app/shared/sources'; import type { Preset, Skin, Styling } from '@app/types'; import { forwardRef, useState } from 'react'; type PreviewProps = { pagePath: string; preset: Preset; skin: Skin; styling: Styling; source: SourceId; }; export const Preview = forwardRef(function Preview( { pagePath, preset, skin, styling, source }, ref ) { const [iframeUrl] = useState( () => `${pagePath}?preset=${encodeURIComponent(preset)}&skin=${encodeURIComponent(skin)}&styling=${encodeURIComponent(styling)}&source=${encodeURIComponent(source)}` ); const openUrl = `${pagePath}?preset=${encodeURIComponent(preset)}&skin=${encodeURIComponent(skin)}&styling=${encodeURIComponent(styling)}` + `&source=${encodeURIComponent(source)}`; return (
Open