forked from sendgrid/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAcademyLink.jsx
More file actions
42 lines (37 loc) · 1023 Bytes
/
Copy pathAcademyLink.jsx
File metadata and controls
42 lines (37 loc) · 1023 Bytes
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
import React from 'react';
import config from '../../data/SiteConfig';
class AcademyLink extends React.Component {
componentDidMount() {
this.dataLayer = window.dataLayer || [];
}
handleClick = () => {
this.dataLayer.push({
event: 'customEvent',
eventCategory: 'Academy Callout',
eventAction: 'Click',
eventLabel: 'Go to Course',
eventValue: `${this.props.courselink}`,
});
}
render() {
// check for empty AcademyLink
if (!this.props.children) {
return null;
}
return (
<div className="academy-callout">
<div className="academy-callout__copy">
{this.props.children.map(el => el)}
<a
href={this.props.courselink}
onClick={this.handleClick}
>
GO TO COURSE →
</a>
</div>
<div className="academy-callout__img" style={{ backgroundImage: `url(${config.envPrefix + this.props.img})` }} />
</div>
);
}
}
export default AcademyLink;