Skip to content
Permalink
Browse files

DCN-202 - HubSpot form implementation for Article

  • Loading branch information...
kenticomartinh committed Jun 12, 2019
1 parent c56abd6 commit aae72eb1e2195aced965c0e60729f691141f9ca1
Showing with 90 additions and 12 deletions.
  1. +59 −10 package-lock.json
  2. +1 −0 package.json
  3. +1 −1 src/Client.js
  4. +22 −0 src/Components/HubspotFormElement.js
  5. +3 −0 src/Models/article.js
  6. +2 −0 src/Pages/Article.js
  7. +2 −1 src/Stores/Article.js

Some generated files are not rendered by default. Learn more.

@@ -22,6 +22,7 @@
"react-cookie": "^3.0.4",
"react-dom": "^16.4.2",
"react-helmet": "^5.2.0",
"react-hubspot-form": "^1.3.7",
"react-router-dom": "^4.3.1",
"react-scroll": "^1.7.10",
"react-translate": "^6.0.0",
@@ -22,7 +22,7 @@ import { HostedVideo } from './Models/hosted_video';
import { Office } from './Models/office';
import { Tweet } from './Models/tweet';

const projectId = '';
const projectId = '471f9f4c-4f97-009b-a0b8-79db2558e63f';
const previewApiKey = '';

// configure type resolvers
@@ -0,0 +1,22 @@
import React, { Component } from 'react';
import HubspotForm from 'react-hubspot-form';

class HubspotFormElement extends Component {
render() {
const form = this.props.form;
const value = form && form.value && JSON.parse(form.value);

if (!value) {
return null;
}

return (
<>
<h2>{value.name}</h2>
<HubspotForm portalId={value.portalId} formId={value.id} />
</>
);
}
}

export default HubspotFormElement;
@@ -50,6 +50,9 @@ export class Article extends ContentItem {
if (fieldName === 'metadata__og_image') {
return 'metadataOgImage';
}
if (fieldName === 'hubspot_form') {
return 'hubspotForm';
}
if (fieldName === 'related_articles') {
return 'relatedArticles';
}
@@ -6,6 +6,7 @@ import RichTextElement from '../Components/RichTextElement';
import { dateFormats } from '../Utilities/LanguageCodes';
import Metadata from '../Components/Metadata';
import { translate } from 'react-translate';
import HubspotFormElement from '../Components/HubspotFormElement';

let getState = props => {
return {
@@ -124,6 +125,7 @@ class Article extends Component {
</div>
</div>
<div className="row">{bodyCopyElement}</div>
<HubspotFormElement form={article.hubspotForm} />
</article>
</div>
);
@@ -49,7 +49,8 @@ class Article {
'metadata__twitter_site',
'metadata__twitter_creator',
'metadata__twitter_description',
'metadata__twitter_image'
'metadata__twitter_image',
'hubspot_form'
]);

if (language) {

0 comments on commit aae72eb

Please sign in to comment.
You can’t perform that action at this time.