-
-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathLayout.js
More file actions
85 lines (80 loc) · 3 KB
/
Layout.js
File metadata and controls
85 lines (80 loc) · 3 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import React, { useEffect, useState } from "react";
import Head from "next/head";
import { useRouter } from "next/router";
import Footer from "./Footer";
import Header from "./Header";
const Layout = ({ children, title, description, metainfo }) => {
const currentPath = useRouter().pathname;
const [secondaryNavbar, setSecondaryNavbar] = useState(false);
const [loading, setLoading] = useState(true);
useEffect(() => {
if (
currentPath === "/events/23/hackrplay/2022/home" ||
currentPath === "/events/23/twoplaysamonth"
) {
setSecondaryNavbar(false);
} else {
setSecondaryNavbar(true);
}
if (metainfo?.name) {
setLoading(false);
}
}, []);
return (
<>
{!loading ? (
<div className={`relative bg-brand-bg overflow-clip`}>
<Head>
<title>{title}</title>
<link rel="icon" href="/favicon.png" />
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0"
/>
<meta name="keywords" content={metainfo.keywords} />
<meta property="og:type" content="website" />
<meta property="og:site_name" content="ReactPlay Events" />
<meta property="og:image:type" content="image/png" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="628" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="description" content={metainfo.description} />
<meta property="og:description" content={metainfo.description} />
<meta name="title" property="og:title" content={title} />
<meta
name="image"
property="og:image"
content={`https://hustles.reactplay.io/${metainfo.name}/og-image.png`}
/>
<meta property="og:image:alt" content={metainfo.description} />
<meta property="og:image:alt" content={metainfo.description} />
<meta property="og:url" content="https://hustles.reactplay.io" />
<meta name="twitter:title" content={title} />
<meta name="twitter:description" content={metainfo.description} />
<meta
name="twitter:image"
content={`https://hustles.reactplay.io/${metainfo.name}/og-image.png`}
/>
<meta name="twitter:site" content="@ReactPlayIO" />
<script
async
defer
data-website-id={process.env.NEXT_PUBLIC_UMAMI_TRACK_ID}
src="https://analytics.reactplay.io/umami.js"
/>
</Head>
<Header
links={metainfo.links}
secondary={secondaryNavbar}
metainfo={metainfo}
/>
<main>{children}</main>
<Footer />
</div>
) : null}
</>
);
};
export default Layout;