-
Notifications
You must be signed in to change notification settings - Fork 10.3k
/
Copy pathhubspot-form.js
69 lines (66 loc) · 2.05 KB
/
hubspot-form.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import React, { Component } from "react"
import HubspotForm from "react-hubspot-form"
import hex2rgba from "hex2rgba"
import { colors, radii, space, scale } from "../utils/presets"
import { formInput } from "../utils/styles"
import { buttonStyles } from "../utils/styles"
export default class GatsbyHubspotForm extends Component {
render() {
const portalId = this.props.portalId || this.props[`portal-id`]
const formId = this.props.formId || this.props[`form-id`]
const sfdcCampaignId =
this.props.sfdcCampaignId || this.props[`sfdc-campaign-id`]
// See https://designers.hubspot.com/docs/cos/hubspot-form-markup#styling-forms for information on how to style the form
return (
<div
css={{
backgroundColor: colors.ui.light,
borderRadius: radii[1],
color: colors.gatsby,
padding: space[4],
"& form": {
margin: 0,
},
"& .hs-form fieldset": {
maxWidth: `none`,
width: `100%`,
},
"& .hs-form-field": {
paddingBottom: space[5],
},
"& ul.hs-error-msgs": {
listStyleType: `none`,
margin: 0,
color: colors.warning,
fontSize: scale[1],
},
"& .hs-form-required": {
color: colors.warning,
},
"& .hs-form input": {
...formInput,
},
'& .hs-form input[type="text"], .hs-form input[type="email"], .hs-form input[type="number"]': {
width: `100% !important`,
":focus": {
borderColor: colors.gatsby,
outline: 0,
boxShadow: `0 0 0 ${space[1]} ${hex2rgba(colors.lilac, 0.25)}`,
},
},
"& .hs-button.primary": {
...buttonStyles.default,
},
}}
>
<HubspotForm
portalId={portalId}
formId={formId}
sfdcCampaignId={sfdcCampaignId}
loading="Loading..."
{...{ css: `` }}
/>
</div>
)
}
}