@@ -5,57 +5,86 @@ import Link from '@docusaurus/Link'
5
5
import useDocusaurusContext from '@docusaurus/useDocusaurusContext'
6
6
import useBaseUrl from '@docusaurus/useBaseUrl'
7
7
import styles from './styles.module.css'
8
+ import CookieConsent , { Cookies } from 'react-cookie-consent'
9
+ import { useLocation } from '@docusaurus/router'
8
10
9
11
export default function Home ( ) {
12
+ let location = useLocation ( )
13
+
14
+ React . useEffect ( ( ) => {
15
+ // check if dataLayer exists i.e can we track or not?
16
+ if ( typeof dataLayer !== 'undefined' ) {
17
+ // send new event to Google Tag Manager
18
+ dataLayer . push ( { event : 'pageview' } )
19
+ }
20
+ } , [ location ] )
21
+
10
22
const context = useDocusaurusContext ( )
11
23
const { siteConfig = { } } = context
12
24
return (
13
- < Layout title = { `${ siteConfig . title } ` } description = { `${ siteConfig . tagline } ` } >
14
- < header
15
- className = { clsx ( 'hero hero--primary' , styles . heroBanner ) }
16
- style = { { minHeight : '70vh' } }
25
+ < >
26
+ < CookieConsent
27
+ location = 'bottom'
28
+ buttonText = 'Accept cookies'
29
+ cookieName = 'AnalyticsConsent'
30
+ style = { { background : '#2B373B' } }
31
+ buttonStyle = { { color : '#4e503b' , fontSize : '13px' } }
32
+ expires = { 150 }
33
+ enableDeclineButton
34
+ declineButtonText = 'Reject cookies'
17
35
>
18
- < div className = 'container' >
19
- < img
20
- alt = 'Awesome HA Blueprints logo'
21
- src = { useBaseUrl ( 'img/logo.svg' ) }
22
- className = 'margin-bottom--lg'
23
- style = { { width : 80 } }
24
- />
25
- < h1 className = 'hero__title' style = { { color : 'white' } } >
26
- { siteConfig . title }
27
- </ h1 >
28
- < p className = 'hero__subtitle' style = { { color : 'white' } } >
29
- A curated collection of blueprints for Home Assistant.
30
- < br />
31
- Reliable, customizable, fully tested by the community.
32
- </ p >
33
- < div className = { `row margin-top--xl ${ styles . buttons } ` } >
34
- < div className = 'col margin-bottom--lg' >
35
- < Link
36
- className = { clsx (
37
- 'button button button--secondary button--lg margin-horiz--sm' ,
38
- styles . getStarted ,
39
- ) }
40
- to = { useBaseUrl ( 'docs/introduction' ) }
41
- >
42
- Get Started
43
- </ Link >
44
- </ div >
45
- < div className = 'col margin-bottom--lg' >
46
- < Link
47
- className = { clsx (
48
- 'button button button--secondary button--lg margin-horiz--sm' ,
49
- styles . getStarted ,
50
- ) }
51
- to = { useBaseUrl ( 'docs/blueprints' ) }
52
- >
53
- Browse Blueprints
54
- </ Link >
36
+ This website uses cookies to enhance the user experience.
37
+ </ CookieConsent >
38
+ < Layout
39
+ title = { `${ siteConfig . title } ` }
40
+ description = { `${ siteConfig . tagline } ` }
41
+ >
42
+ < header
43
+ className = { clsx ( 'hero hero--primary' , styles . heroBanner ) }
44
+ style = { { minHeight : '70vh' } }
45
+ >
46
+ < div className = 'container' >
47
+ < img
48
+ alt = 'Awesome HA Blueprints logo'
49
+ src = { useBaseUrl ( 'img/logo.svg' ) }
50
+ className = 'margin-bottom--lg'
51
+ style = { { width : 80 } }
52
+ />
53
+ < h1 className = 'hero__title' style = { { color : 'white' } } >
54
+ { siteConfig . title }
55
+ </ h1 >
56
+ < p className = 'hero__subtitle' style = { { color : 'white' } } >
57
+ A curated collection of blueprints for Home Assistant.
58
+ < br />
59
+ Reliable, customizable, fully tested by the community.
60
+ </ p >
61
+ < div className = { `row margin-top--xl ${ styles . buttons } ` } >
62
+ < div className = 'col margin-bottom--lg' >
63
+ < Link
64
+ className = { clsx (
65
+ 'button button button--secondary button--lg margin-horiz--sm' ,
66
+ styles . getStarted ,
67
+ ) }
68
+ to = { useBaseUrl ( 'docs/introduction' ) }
69
+ >
70
+ Get Started
71
+ </ Link >
72
+ </ div >
73
+ < div className = 'col margin-bottom--lg' >
74
+ < Link
75
+ className = { clsx (
76
+ 'button button button--secondary button--lg margin-horiz--sm' ,
77
+ styles . getStarted ,
78
+ ) }
79
+ to = { useBaseUrl ( 'docs/blueprints' ) }
80
+ >
81
+ Browse Blueprints
82
+ </ Link >
83
+ </ div >
55
84
</ div >
56
85
</ div >
57
- </ div >
58
- </ header >
59
- </ Layout >
86
+ </ header >
87
+ </ Layout >
88
+ </ >
60
89
)
61
90
}
0 commit comments