Skip to content

Commit 28d3701

Browse files
Cleanup
1 parent 84fea55 commit 28d3701

4 files changed

Lines changed: 120 additions & 168 deletions

File tree

Lines changed: 118 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,129 @@
11
---
2-
import NavbarContent from './shared/NavbarContent.astro';
2+
import config from 'virtual:starlight/user-config';
3+
import type { Props } from '@astrojs/starlight/props';
4+
import { Image } from 'astro:assets';
5+
import Search from 'virtual:starlight/components/Search';
6+
7+
import HeadphonesIcon from '@assets/headset-icon.svg';
8+
import PipelineIcon from '@assets/pipelines.svg';
9+
import TerragruntLogo from '@assets/horizontal-logo-light.svg';
10+
import ThemeToggle from '@components/ThemeToggle.astro';
311
import '@styles/global.css';
412
5-
let starCountDisplay = '8.6k';
13+
/**
14+
* Render the `Search` component if Pagefind is enabled or the default search component has been overridden.
15+
*/
16+
const shouldRenderSearch =
17+
config.pagefind || config.components.Search !== '@astrojs/starlight/components/Search.astro';
18+
19+
interface Props {
20+
showThemeToggle?: boolean;
21+
}
22+
23+
const { showThemeToggle = true } = Astro.props;
24+
25+
let starCountDisplay = process.env.GITHUB_STARS || '8.6k';
626
727
try {
8-
const response = await fetch('https://api.github.com/repos/gruntwork-io/terragrunt');
9-
if (response.ok) {
10-
const data = await response.json();
11-
const stars = data.stargazers_count;
12-
if (typeof stars === 'number') {
13-
starCountDisplay = (stars / 1000).toFixed(1) + 'k';
14-
}
15-
} else {
16-
console.error('Failed to fetch GitHub stars:', response.status, await response.text());
17-
}
28+
// Only fetch if not in environment variable
29+
if (!process.env.GITHUB_STARS) {
30+
const response = await fetch('https://api.github.com/repos/gruntwork-io/terragrunt', {
31+
headers: {
32+
'User-Agent': 'Terragrunt-Docs'
33+
}
34+
});
35+
if (response.ok) {
36+
const data = await response.json();
37+
const stars = data.stargazers_count;
38+
if (typeof stars === 'number') {
39+
starCountDisplay = (stars / 1000).toFixed(1) + 'k';
40+
}
41+
} else {
42+
console.error('Failed to fetch GitHub stars:', response.status, await response.text());
43+
}
44+
}
1845
} catch (error) {
19-
console.error('Error fetching GitHub stars:', error);
46+
console.error('Error fetching GitHub stars:', error);
2047
}
2148
---
2249

2350
<div class="navbar">
24-
<NavbarContent
25-
starCountDisplay={starCountDisplay}
26-
showThemeToggle={true}
27-
/>
51+
<!-- Logo -->
52+
<a href="/" class="hover:cursor-pointer">
53+
<Image
54+
alt="Terragrunt Logo"
55+
class="h-auto w-[145px] md:w-[180px] xl:w-[200px]"
56+
loading="eager"
57+
src={TerragruntLogo}
58+
/>
59+
</a>
60+
<!-- Right Menu -->
61+
<div class="flex items-center gap-6">
62+
<div class="flex items-center gap-6">
63+
<!-- Docs -->
64+
<div class="pr-0 border-r lg:border-stroke-dark lg:px-6">
65+
<a href="/docs" class="flex items-center gap-2 text-gray-1 text-sm font-sans no-underline hover:underline hover:decoration-[var(--sl-color-gray-1)] hover:text-[var(--sl-color-gray-1)]">
66+
<svg class="hidden sm:block" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
67+
<path opacity="0.1" d="M17.8284 6.82843C18.4065 7.40649 18.6955 7.69552 18.8478 8.06306C19 8.4306 19 8.83935 19 9.65685L19 17C19 18.8856 19 19.8284 18.4142 20.4142C17.8284 21 16.8856 21 15 21H9C7.11438 21 6.17157 21 5.58579 20.4142C5 19.8284 5 18.8856 5 17L5 7C5 5.11438 5 4.17157 5.58579 3.58579C6.17157 3 7.11438 3 9 3H12.3431C13.1606 3 13.5694 3 13.9369 3.15224C14.3045 3.30448 14.5935 3.59351 15.1716 4.17157L17.8284 6.82843Z" fill="currentColor"/>
68+
<path d="M17.8284 6.82843C18.4065 7.40649 18.6955 7.69552 18.8478 8.06306C19 8.4306 19 8.83935 19 9.65685L19 17C19 18.8856 19 19.8284 18.4142 20.4142C17.8284 21 16.8856 21 15 21H9C7.11438 21 6.17157 21 5.58579 20.4142C5 19.8284 5 18.8856 5 17L5 7C5 5.11438 5 4.17157 5.58579 3.58579C6.17157 3 7.11438 3 9 3H12.3431C13.1606 3 13.5694 3 13.9369 3.15224C14.3045 3.30448 14.5935 3.59351 15.1716 4.17157L17.8284 6.82843Z" stroke="currentColor" stroke-width="2" stroke-linejoin="round"/>
69+
<path d="M9 12H15" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"/>
70+
<path d="M9 15H15" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"/>
71+
</svg>
72+
<span>Docs</span>
73+
</a>
74+
</div>
75+
<!-- Socials -->
76+
<div class="hidden lg:flex items-center border-r border-stroke-dark pr-6 gap-4">
77+
<a href="https://github.com/gruntwork-io/terragrunt" class="social-icon flex items-center gap-2 transition .25s ease-in-out" target="_blank" rel="noopener noreferrer">
78+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" class="bi bi-github" viewBox="0 0 16 16">
79+
<path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8"/>
80+
</svg>
81+
<span class="text-sm font-sans">{starCountDisplay}</span>
82+
</a>
83+
<a href="https://discord.com/invite/YENaT9h8jh" class="social-icon flex items-center gap-2 transition .25s ease-in-out" target="_blank" rel="noopener noreferrer">
84+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" class="bi bi-discord" viewBox="0 0 16 16">
85+
<path d="M13.545 2.907a13.2 13.2 0 0 0-3.257-1.011.05.05 0 0 0-.052.025c-.141.25-.297.577-.406.833a12.2 12.2 0 0 0-3.658 0 8 8 0 0 0-.412-.833.05.05 0 0 0-.052-.025c-1.125.194-2.22.534-3.257 1.011a.04.04 0 0 0-.021.018C.356 6.024-.213 9.047.066 12.032q.003.022.021.037a13.3 13.3 0 0 0 3.995 2.02.05.05 0 0 0 .056-.019q.463-.63.818-1.329a.05.05 0 0 0-.01-.059l-.018-.011a9 9 0 0 1-1.248-.595.05.05 0 0 1-.02-.066l.015-.019q.127-.095.248-.195a.05.05 0 0 1 .051-.007c2.619 1.196 5.454 1.196 8.041 0a.05.05 0 0 1 .053.007q.121.1.248.195a.05.05 0 0 1-.004.085 8 8 0 0 1-1.249.594.05.05 0 0 0-.03.03.05.05 0 0 0 .003.041c.24.465.515.909.817 1.329a.05.05 0 0 0 .056.019 13.2 13.2 0 0 0 4.001-2.02.05.05 0 0 0 .021-.037c.334-3.451-.559-6.449-2.366-9.106a.03.03 0 0 0-.02-.019m-8.198 7.307c-.789 0-1.438-.724-1.438-1.612s.637-1.613 1.438-1.613c.807 0 1.45.73 1.438 1.613 0 .888-.637 1.612-1.438 1.612m5.316 0c-.788 0-1.438-.724-1.438-1.612s.637-1.613 1.438-1.613c.807 0 1.451.73 1.438 1.613 0 .888-.631 1.612-1.438 1.612"/>
86+
</svg>
87+
</a>
88+
</div>
89+
<!-- SearchBar -->
90+
<div class="hidden lg:block w-[280px]">
91+
{shouldRenderSearch && <Search {...Astro.props} />}
92+
</div>
93+
{showThemeToggle && <ThemeToggle />}
94+
</div>
95+
<div class="flex items-center gap-3 md:gap-3.5">
96+
<!-- Buttons -->
97+
<a href="https://www.gruntwork.io/platform/pipelines" class="hidden md:flex secondary-button items-center h-[39px]">
98+
CI/CD for Terragrunt
99+
</a>
100+
<a href="https://www.gruntwork.io/platform/pipelines" class="flex md:hidden secondary-button !p-3">
101+
<Image
102+
src={PipelineIcon}
103+
alt="Pipeline Icon"
104+
width={20}
105+
height={20}
106+
/>
107+
</a>
108+
<a href="https://www.gruntwork.io/services/terragrunt" class="hidden md:flex primary-button items-center h-[39px]">
109+
Enterprise Support
110+
</a>
111+
<a href="https://www.gruntwork.io/services/terragrunt" class="flex md:hidden primary-button !p-3">
112+
<Image
113+
src={HeadphonesIcon}
114+
alt="Headphones Icon"
115+
width={20}
116+
height={20}
117+
class={"aspect-[1/1] h-auto"}
118+
/>
119+
</a>
120+
</div>
121+
</div>
122+
</div>
123+
124+
<!-- Mobile Search -->
125+
<div class="block md:hidden justify-center bg-bg-dark px-5 py-2.5 border-b border-stroke-dark">
126+
<div class="flex items-center">
127+
{shouldRenderSearch && <Search {...Astro.props} />}
128+
</div>
28129
</div>

docs-starlight/src/components/dv-Navbar.astro

Lines changed: 0 additions & 36 deletions
This file was deleted.

docs-starlight/src/components/shared/NavbarContent.astro

Lines changed: 0 additions & 112 deletions
This file was deleted.

docs-starlight/src/pages/index.astro

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
import '@styles/global.css';
3-
import Navbar from '@components/dv-Navbar.astro';
3+
import Header from '@components/Header.astro';
44
import Hero from '@components/dv-Hero.astro';
55
import FeaturedBrands from '@components/dv-FeaturedBrands.astro';
66
import OrchestrateSection from '@components/dv-OrchestrateSection.astro';
@@ -22,8 +22,7 @@ import Testimonials from '@components/dv-Testimonials.astro';
2222
</head>
2323
<body class="flex flex-col min-h-screen bg-[#FAFAFA]">
2424
<div class="fixed top-0 z-50">
25-
<!-- @ts-ignore -->
26-
<Navbar />
25+
<Header showThemeToggle={false} />
2726
</div>
2827
<div class="absolute top-[149px] md:top-[83px] w-full">
2928
<Hero />

0 commit comments

Comments
 (0)