-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathbase.astro
More file actions
106 lines (102 loc) · 3.42 KB
/
base.astro
File metadata and controls
106 lines (102 loc) · 3.42 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
---
import { Logo } from '@framework/system/src/components/logo'
import { Sidebar } from '@framework/system/src/components/sidebar'
import FontHeadTags from '@framework/system/src/globals/font-import.astro'
import '@framework/system/src/globals/global-styles.ts'
import { sprinkles } from '@framework/system/src/sprinkles/sprinkles.css'
import {
bodyWithNav,
shrinkable,
} from '@framework/system/src/styles/layouts.css'
import * as themes from '@framework/system/src/themes/themes.css.ts'
import classNames from 'classnames'
import pick from 'lodash/pick'
import { MobileNav } from '../components/mobile-nav'
import { NavItems } from '../components/nav-items'
import { SocialMetaTags } from '../components/social-meta-tags'
import { getSearchData } from '@framework/site/src/utils/search-data'
const { title, currentCategory, currentTag, className } = Astro.props
const searchData = await getSearchData(import.meta.env.VITE_FRAMEWORK)
const navData = searchData.map((o) => pick(o, ['name', 'subCategories']))
const themeClass = themes[
`${import.meta.env.VITE_FRAMEWORK}Theme` as keyof typeof themes
] as string
const GA_TAG_ID = import.meta.env.VITE_GOOGLE_ANALYTICS
---
<!doctype html>
<html class={themeClass} lang="en">
<head>
<FontHeadTags />
<title>{title}</title>
<meta name="robots" content="noindex" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<SocialMetaTags
title={`${currentCategory ? currentCategory : 'Featured Resources'} | ${
import.meta.env.VITE_FRAMEWORK
}.framework.dev`}
siteName={import.meta.env.VITE_FRAMEWORK}
/>
<meta name="msapplication-TileColor" content="#da532c" />
<meta name="theme-color" content="#ffffff" />
<meta charset="UTF-8" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
<link rel="manifest" href="/site.webmanifest" />
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5" />
{
import.meta.env.MODE === 'production' && (
<script
is:inline
async
src={`https://www.googletagmanager.com/gtag/js?id=${import.meta.env.VITE_GOOGLE_ANALYTICS}`}>
</script>
<script is:inline define:vars={{ GA_TAG_ID }}>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
window.gtag = gtag;
gtag('js', new Date());
gtag('config', GA_TAG_ID);
</script>
)
}
</head>
<body
class={classNames(
sprinkles({ backgroundColor: 'surface1', height: 'full' }),
bodyWithNav
)}
>
<Sidebar aria-label="primary" siteName={import.meta.env.VITE_FRAMEWORK}>
<div class={sprinkles({ layout: 'stack', gap: 24 })}>
<NavItems
data={navData}
currentCategory={currentCategory}
currentTag={currentTag}
/>
</div>
</Sidebar>
<main class={classNames(className, shrinkable)} id="main-content">
<div
class={sprinkles({
layout: 'row',
justifyContent: 'center',
display: { desktop: 'none' },
width: 'full',
paddingY: 24,
})}
>
<Logo siteName={import.meta.env.VITE_FRAMEWORK} />
</div>
<slot />
</main>
<MobileNav
aria-label="primary"
client:visible
data={navData}
currentCategory={currentCategory}
currentTag={currentTag}
className={sprinkles({ display: { mobile: 'flex', desktop: 'none' } })}
/>
</body>
</html>