|
1 | 1 | /** @jsx jsx */
|
2 | 2 | import { jsx } from "theme-ui"
|
3 |
| -import { Component } from "react" |
4 | 3 |
|
5 |
| -import HubspotForm from "./react-hubspot-form" |
| 4 | +import ReactHubspotForm from "./react-hubspot-form" |
6 | 5 | import { formInput, formInputFocus, buttonStyles } from "../utils/styles"
|
7 | 6 |
|
8 |
| -export default class GatsbyHubspotForm extends Component { |
9 |
| - render() { |
10 |
| - const portalId = this.props.portalId || this.props[`portal-id`] |
11 |
| - const formId = this.props.formId || this.props[`form-id`] |
12 |
| - const sfdcCampaignId = |
13 |
| - this.props.sfdcCampaignId || this.props[`sfdc-campaign-id`] |
14 |
| - |
15 |
| - // See https://designers.hubspot.com/docs/cos/hubspot-form-markup#styling-forms for information on how to style the form |
16 |
| - return ( |
17 |
| - <div |
18 |
| - sx={{ |
19 |
| - "& form": { |
20 |
| - margin: 0, |
21 |
| - }, |
22 |
| - "& .hs-form fieldset": { |
23 |
| - maxWidth: `none`, |
24 |
| - width: `100%`, |
25 |
| - }, |
26 |
| - "& .hs-form-field": { |
27 |
| - pb: 5, |
28 |
| - }, |
29 |
| - "& ul.hs-error-msgs": { |
30 |
| - listStyleType: `none`, |
31 |
| - margin: 0, |
32 |
| - color: `warning`, |
33 |
| - fontSize: 1, |
34 |
| - }, |
35 |
| - "& .hs-form input": { |
36 |
| - ...formInput, |
37 |
| - }, |
38 |
| - '& .hs-form input[type="text"], .hs-form input[type="email"], .hs-form input[type="number"]': { |
39 |
| - width: `100% !important`, |
40 |
| - ":focus": { |
41 |
| - ...formInputFocus, |
42 |
| - }, |
43 |
| - }, |
44 |
| - "& label": { |
45 |
| - // a bit unsure about the implications of the next line |
46 |
| - display: `inline-block`, |
47 |
| - fontSize: 1, |
48 |
| - pb: 1, |
49 |
| - }, |
50 |
| - "& .hs-form-required": { |
51 |
| - color: `textMuted`, |
52 |
| - }, |
53 |
| - "& .hs-button.primary": { |
54 |
| - ...buttonStyles().default, |
55 |
| - }, |
56 |
| - }} |
57 |
| - > |
58 |
| - <HubspotForm |
59 |
| - portalId={portalId} |
60 |
| - formId={formId} |
61 |
| - sfdcCampaignId={sfdcCampaignId} |
62 |
| - loading="Loading..." |
63 |
| - {...{ css: `` }} |
64 |
| - /> |
65 |
| - </div> |
66 |
| - ) |
67 |
| - } |
| 7 | +export default function HubspotForm({ portalId, formId, sfdcCampaignId }) { |
| 8 | + // See https://designers.hubspot.com/docs/cos/hubspot-form-markup#styling-forms for information on how to style the form |
| 9 | + return ( |
| 10 | + <div |
| 11 | + sx={{ |
| 12 | + "& form": { |
| 13 | + margin: 0, |
| 14 | + }, |
| 15 | + "& .hs-form fieldset": { |
| 16 | + maxWidth: `none`, |
| 17 | + width: `100%`, |
| 18 | + }, |
| 19 | + "& .hs-form-field": { |
| 20 | + pb: 5, |
| 21 | + }, |
| 22 | + "& ul.hs-error-msgs": { |
| 23 | + listStyleType: `none`, |
| 24 | + margin: 0, |
| 25 | + color: `warning`, |
| 26 | + fontSize: 1, |
| 27 | + }, |
| 28 | + "& .hs-form input": { |
| 29 | + ...formInput, |
| 30 | + }, |
| 31 | + '& .hs-form input[type="text"], .hs-form input[type="email"], .hs-form input[type="number"]': { |
| 32 | + width: `100% !important`, |
| 33 | + ":focus": { |
| 34 | + ...formInputFocus, |
| 35 | + }, |
| 36 | + }, |
| 37 | + "& label": { |
| 38 | + // a bit unsure about the implications of the next line |
| 39 | + display: `inline-block`, |
| 40 | + fontSize: 1, |
| 41 | + pb: 1, |
| 42 | + }, |
| 43 | + "& .hs-form-required": { |
| 44 | + color: `textMuted`, |
| 45 | + }, |
| 46 | + "& .hs-button.primary": { |
| 47 | + ...buttonStyles().default, |
| 48 | + }, |
| 49 | + }} |
| 50 | + > |
| 51 | + <ReactHubspotForm |
| 52 | + portalId={portalId} |
| 53 | + formId={formId} |
| 54 | + sfdcCampaignId={sfdcCampaignId} |
| 55 | + loading="Loading..." |
| 56 | + {...{ css: `` }} |
| 57 | + /> |
| 58 | + </div> |
| 59 | + ) |
68 | 60 | }
|
0 commit comments