2
0
Files
bot/apps/builder/components/share/codeSnippets/Iframe/EmbedCode.tsx

23 lines
670 B
TypeScript
Raw Normal View History

import { FlexProps } from '@chakra-ui/react'
import { CodeEditor } from 'components/shared/CodeEditor'
import { useTypebot } from 'contexts/TypebotContext'
2022-08-08 08:21:36 +02:00
import { env, getViewerUrl } from 'utils'
type Props = {
widthLabel: string
heightLabel: string
onCopied?: () => void
}
export const IframeEmbedCode = ({
widthLabel,
heightLabel,
}: Props & FlexProps) => {
const { typebot } = useTypebot()
const src = `${
2022-08-08 08:21:36 +02:00
env('VIEWER_INTERNAL_URL') ?? getViewerUrl({ isBuilder: true })
}/${typebot?.publicId}`
const code = `<iframe src="${src}" width="${widthLabel}" height="${heightLabel}" />`
return <CodeEditor value={code} lang="html" isReadOnly />
}