forked from datahub-project/datahub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add cloud form & fix css (datahub-project#11362)
- Loading branch information
1 parent
7e7d174
commit 54b8ce3
Showing
7 changed files
with
254 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import React, { useEffect } from 'react'; | ||
import clsx from "clsx"; | ||
import Link from "@docusaurus/Link"; | ||
import styles from "./styles.module.scss"; | ||
import ScrollingCustomers from '../CompanyLogos'; | ||
import './hubspotFormStyles.css'; | ||
|
||
const DemoForm = ({ formId }) => { | ||
useEffect(() => { | ||
const formContainerId = `hubspotForm-${formId}`; | ||
|
||
const initializeHubspotForm = () => { | ||
if (!document.querySelector(`#${formContainerId} .hs-form`)) { | ||
window.hbspt.forms.create({ | ||
region: "na1", | ||
portalId: "14552909", | ||
formId: "ed2447d6-e6f9-4771-8f77-825b114a9421", | ||
target: `#${formContainerId}`, | ||
}); | ||
|
||
setTimeout(() => { | ||
const emailInput = document.querySelector(`#${formContainerId} .hs_email .input > input`); | ||
const firstNameInput = document.querySelector(`#${formContainerId} .hs_firstname .input > input`); | ||
const lastNameInput = document.querySelector(`#${formContainerId} .hs_lastname .input > input`); | ||
const phoneInput = document.querySelector(`#${formContainerId} .hs_phone .input > input`); | ||
const additionalInfoInput = document.querySelector(`#${formContainerId} .hs_additional_info .input > textarea`); | ||
|
||
if (emailInput) emailInput.placeholder = 'Company Email'; | ||
if (firstNameInput) firstNameInput.placeholder = 'First Name'; | ||
if (lastNameInput) lastNameInput.placeholder = 'Last Name'; | ||
if (phoneInput) phoneInput.placeholder = 'Phone Number'; | ||
if (additionalInfoInput) additionalInfoInput.placeholder = 'How can we help?'; | ||
|
||
const selectNoEElement = document.getElementById(`number_of_employees-ed2447d6-e6f9-4771-8f77-825b114a9421`); | ||
if (selectNoEElement) { | ||
const disabledOption = selectNoEElement.querySelector('option[disabled]'); | ||
if (disabledOption) { | ||
disabledOption.text = "Select Number of Employees"; | ||
disabledOption.value = ""; | ||
} | ||
} | ||
const selectfamiliarityElement = document.getElementById(`familiarity_with_acryl_datahub-ed2447d6-e6f9-4771-8f77-825b114a9421`); | ||
if (selectfamiliarityElement) { | ||
const disabledOption = selectfamiliarityElement.querySelector('option[disabled]'); | ||
if (disabledOption) { | ||
disabledOption.text = "How familiar are you with DataHub?"; | ||
disabledOption.value = ""; | ||
} | ||
} | ||
}, 1000); // Delay to ensure the form is fully loaded | ||
|
||
window.hero = new RevenueHero({ routerId: '982' }); | ||
window.hero.schedule('hsForm_ed2447d6-e6f9-4771-8f77-825b114a9421'); | ||
} | ||
}; | ||
|
||
if (!window.hbspt) { | ||
const script = document.createElement('script'); | ||
script.src = "//js.hsforms.net/forms/embed/v2.js"; | ||
script.async = true; | ||
script.type = 'text/javascript'; | ||
document.body.appendChild(script); | ||
|
||
script.onload = () => { | ||
initializeHubspotForm(); | ||
}; | ||
} else { | ||
initializeHubspotForm(); | ||
} | ||
|
||
return () => { | ||
const hubspotForm = document.querySelector(`#${formContainerId} .hs-form`); | ||
if (hubspotForm) { | ||
hubspotForm.remove(); | ||
} | ||
}; | ||
}, [formId]); | ||
|
||
return ( | ||
<div className={clsx(styles.formContainer)}> | ||
<div className={clsx(styles.formContent)}> | ||
<div className={clsx(styles.formHeader)}> | ||
<div className={clsx(styles.formTitle)}>Book a free Demo</div> | ||
<div className={clsx(styles.formSubtitle)}> | ||
Schedule a personalized demo and get a free a trial. | ||
</div> | ||
</div> | ||
<div id={`hubspotForm-${formId}`} className={styles.hubspotForm}></div> {/* Use unique ID */} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default DemoForm; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
.col { | ||
padding: 0 2rem; | ||
} | ||
|
||
.formContainer { | ||
padding: 2rem; | ||
margin: 0 auto; | ||
background-color:#F3F3F3; | ||
border: 1px solid #DDD; | ||
align-items: center; | ||
max-width: 540px; | ||
border-radius: 16px; | ||
|
||
.formContent { | ||
width: 90%; | ||
margin: 0 auto; | ||
} | ||
|
||
.formHeader { | ||
justify-content: space-between; | ||
text-align: left; | ||
|
||
.formTitle { | ||
font-size: 24px; | ||
font-weight: 600; | ||
color: #000; | ||
line-height: 28px; | ||
margin-bottom: 12px; | ||
} | ||
|
||
.formSubtitle { | ||
font-size: 14px; | ||
color: #666; | ||
line-height: 14px; | ||
margin-bottom: 8px; | ||
} | ||
} | ||
|
||
} | ||
|
||
.bookButton { | ||
display: none; | ||
} | ||
|
||
@media screen and (max-width: 999px) { | ||
.bookButton { | ||
display: block; | ||
} | ||
.formContainer { | ||
display: none; | ||
} | ||
.productTourButton { | ||
text-align: center!important; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.