2022-02-10 08:08:58 +01:00
|
|
|
import { FlexProps } from '@chakra-ui/react'
|
|
|
|
import { CodeEditor } from 'components/shared/CodeEditor'
|
|
|
|
import { useTypebot } from 'contexts/TypebotContext'
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
widthLabel: string
|
|
|
|
heightLabel: string
|
|
|
|
onCopied?: () => void
|
|
|
|
}
|
|
|
|
export const IframeEmbedCode = ({
|
|
|
|
widthLabel,
|
|
|
|
heightLabel,
|
|
|
|
}: Props & FlexProps) => {
|
|
|
|
const { typebot } = useTypebot()
|
2022-03-21 18:52:43 +01:00
|
|
|
const src = `${
|
|
|
|
process.env.NEXT_PUBLIC_VIEWER_INTERNAL_URL ??
|
|
|
|
process.env.NEXT_PUBLIC_VIEWER_URL
|
|
|
|
}/${typebot?.publicId}`
|
2022-02-10 08:08:58 +01:00
|
|
|
const code = `<iframe src="${src}" width="${widthLabel}" height="${heightLabel}" />`
|
|
|
|
|
|
|
|
return <CodeEditor value={code} lang="html" isReadOnly />
|
|
|
|
}
|