This repository was archived by the owner on Jul 24, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +30
-2
lines changed Expand file tree Collapse file tree 1 file changed +30
-2
lines changed Original file line number Diff line number Diff line change 1
1
/* global window */
2
- import React from 'react'
2
+ /** @jsx jsx */
3
+ import { jsx } from 'theme-ui'
3
4
import PropTypes from 'prop-types'
4
5
import * as QS from '@gaiama/query-string'
5
6
import { Link as GatsbyLink } from 'gatsby'
@@ -13,6 +14,29 @@ if (typeof window !== `undefined`) {
13
14
window . __navigatingToLink = false
14
15
}
15
16
17
+ const Cta = props => (
18
+ < div
19
+ { ...props }
20
+ sx = { {
21
+ display : `inline-block` ,
22
+ backgroundColor : `cta` ,
23
+ fontWeight : `400` ,
24
+ borderRadius : `3px` ,
25
+ color : `#042f37` ,
26
+ fontSize : `1.2rem` ,
27
+ padding : `0.2rem 0.7rem` ,
28
+ margin : `0 1rem` ,
29
+ textAlign : `center` ,
30
+ a : {
31
+ border : `none` ,
32
+ ':hover' : {
33
+ background : `none` ,
34
+ } ,
35
+ } ,
36
+ } }
37
+ />
38
+ )
39
+
16
40
const Link = ( {
17
41
children,
18
42
to,
@@ -21,6 +45,7 @@ const Link = ({
21
45
ext,
22
46
blank,
23
47
persistQuery,
48
+ cta,
24
49
...props
25
50
} ) => {
26
51
if ( persistQuery ) {
@@ -56,7 +81,9 @@ const Link = ({
56
81
</ GatsbyLink >
57
82
)
58
83
59
- return isExt ? externalLink : internalLink
84
+ const link = isExt ? externalLink : internalLink
85
+
86
+ return ! cta ? link : < Cta > { link } </ Cta >
60
87
}
61
88
62
89
Link . propTypes = {
@@ -66,6 +93,7 @@ Link.propTypes = {
66
93
ext : PropTypes . bool ,
67
94
blank : PropTypes . bool ,
68
95
persistQuery : PropTypes . bool ,
96
+ cta : PropTypes . bool ,
69
97
}
70
98
71
99
Link . defaultProps = {
You can’t perform that action at this time.
0 commit comments