Skip to content

Instantly share code, notes, and snippets.

@petersuhm
Forked from jrbaudin/reform-embed.jsx
Created September 22, 2021 07:07
Show Gist options
  • Select an option

  • Save petersuhm/c790d3d5cfbddec2ba17d156961d718f to your computer and use it in GitHub Desktop.

Select an option

Save petersuhm/c790d3d5cfbddec2ba17d156961d718f to your computer and use it in GitHub Desktop.

Revisions

  1. @jrbaudin jrbaudin created this gist Sep 21, 2021.
    25 changes: 25 additions & 0 deletions reform-embed.jsx
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    import Script from 'next/script'

    type Props = {
    formUrl: string
    }
    export const ReformEmbed = ({ formUrl }: Props) => {
    return (
    <>
    <div id="my-reform" className="z-50 relative" />
    <Script>
    {`window.Reform=window.Reform||function(){(Reform.q=Reform.q||[]).push(arguments)};`}
    </Script>
    <Script
    id="reform-script"
    src="https://embed.reform.app/v1/embed.js"
    onLoad={() => {
    window.Reform('init', {
    url: formUrl,
    target: '#my-reform',
    })
    }}
    />
    </>
    )
    }