-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move duplicated HubSpot code into HubSpot component (#641)
- Loading branch information
Ryan Blunden
committed
Mar 5, 2020
1 parent
0a0add4
commit 5ce5208
Showing
6 changed files
with
26 additions
and
67 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
export interface HubSpotForm { | ||
portalId: string | ||
formId: string | ||
targetId: string | ||
onFormSubmit?: () => void | ||
} | ||
|
||
export function createHubSpotForm({ portalId, formId, targetId, onFormSubmit }: HubSpotForm): void { | ||
const script = document.createElement('script') | ||
script.src = '//js.hsforms.net/forms/v2.js' | ||
const hubspot = document.getElementById(targetId) | ||
hubspot!.appendChild(script) | ||
script.addEventListener('load', () => { | ||
;(window as any).hbspt.forms.create({ | ||
portalId, | ||
formId, | ||
target: `#${targetId}`, | ||
onFormSubmit, | ||
}) | ||
}) | ||
} |
2 changes: 1 addition & 1 deletion
2
website/src/pages/contact/request-code-change-management-demo.tsx
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
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
23 changes: 1 addition & 22 deletions
23
website/src/pages/resources/universal-code-search-ebook.tsx
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