Skip to content

Commit

Permalink
hide nav bar on index load
Browse files Browse the repository at this point in the history
  • Loading branch information
leomcelroy committed Oct 17, 2023
1 parent 963838a commit df4deb9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions astro/src/components/Navbar.astro
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import GitHubIcon from '../ui/GitHubIcon.tsx'
position: sticky;
top: 0;
z-index: 1000;
opacity: 0;
}

nav a {
Expand Down
1 change: 0 additions & 1 deletion astro/src/components/landing/Background.astro
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@
const svgElement = document.querySelector('.svg-container')
subpathElements.forEach(element => svgElement.appendChild(element))

document.querySelector("nav").style.opacity = 0;
setTimeout(() => {
fadeIn(document.querySelector("nav"), 1500);
document.querySelectorAll(".fade-in").forEach(el => {
Expand Down
12 changes: 9 additions & 3 deletions astro/src/layouts/Layout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ import Navbar from '../components/Navbar.astro'
export interface Props {
title: string | undefined
description: string | undefined
showNav: string | undefined
}
let { title, description } = Astro.props
let { title, description, showNav } = Astro.props
title = `Blot | ${title}` || 'Blot'
description = description || 'Blot editor!'
showNav = showNav || 'true'
---

<!DOCTYPE html>
Expand All @@ -22,8 +24,12 @@ description = description || 'Blot editor!'
<meta name="generator" content={Astro.generator} />
<title>{title}</title>
</head>
<body>
<Navbar />
<body data-shownav={showNav}>
<Navbar/>
<slot />
<script client:load>
const showNav = document.body.dataset.shownav;
if (showNav === "true") document.querySelector("nav").style.opacity = 1;
</script>
</body>
</html>
1 change: 1 addition & 0 deletions astro/src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ try {
</style>

<Layout
showNav="false"
title="Blot"
description="Blot, the plotter bot from Hack Club: you code art, we send you a machine.">
<div class="lead-section">
Expand Down

1 comment on commit df4deb9

@vercel
Copy link

@vercel vercel bot commented on df4deb9 Oct 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

blot – ./astro

blot.hackclub.dev
blot-git-main.hackclub.dev

Please sign in to comment.