Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change form in marketing components to be a code embed #124

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions app/api/newsletter/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ async function setEmail(email) {
}

if (body?.category === 'CONFLICT') {
const contactId = body.message?.match(/Existing ID:\s*(?<id>\d+)/)
?.groups?.id
const contactId = body.message?.match(/Existing ID:\s*(\d+)/)?.[1]

if (!contactId) {
return false
Expand Down
File renamed without changes.
17 changes: 17 additions & 0 deletions pages/kubernetes/[...slug].tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { type GetServerSideProps } from 'next'

export const getServerSideProps: GetServerSideProps = async ({ params }) => {
const slug = params?.slug as string[]
const newPath = `/${slug.join('/')}`

return {
redirect: {
destination: newPath,
permanent: true,
},
}
}

export default function KubernetesRedirect() {
return null
}
24 changes: 21 additions & 3 deletions src/components/custom-page/Multimedia.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { type ComponentPropsWithRef } from 'react'

import { Code } from '@pluralsh/design-system'

import styled from 'styled-components'

import { getImageUrl } from '@src/consts/routes'
Expand Down Expand Up @@ -47,7 +45,27 @@ export function Multimedia({
url={videoUrl ?? ''}
/>
) : mediaType === 'form' ? (
<Code css={{ overflow: 'auto', maxHeight: '500px' }}>{form ?? ''}</Code>
<iframe
title="Embedded form content"
css={{
width: '100%',
height: '100%',
minHeight: 550,
}}
sandbox="allow-scripts allow-forms allow-same-origin allow-popups allow-popups-to-escape-sandbox"
srcDoc={`
<!DOCTYPE html>
<html>
<head>
<!-- HubSpot's required script -->
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/embed/v2.js"></script>
</head>
<body>
${form}
</body>
</html>
`}
/>
) : null}
</MultimediaWrapperSC>
)
Expand Down
Loading