Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navbar with links #34

Merged
merged 8 commits into from
Mar 7, 2024
Merged

Navbar with links #34

merged 8 commits into from
Mar 7, 2024

Conversation

hetd54
Copy link
Collaborator

@hetd54 hetd54 commented Mar 7, 2024

Added

Tailwind added

Prettier integration with tailwind requires plugin

Changed

consts.ts

Added array of navbar links

Header.astro

Removed default blog-related things
Removed style tags in favor of inline Tailwind styling

HeaderLink.astro

Removed style tags in favor of inline Tailwind styling

Helpful Links

Tailwind:

Images

Full View

Screenshot 2024-03-07 at 11 12 15 AM

Tablet & Mobile

Screenshot 2024-03-07 at 10 50 13 AM

Tablet & Mobile, clicked hamburger

Screenshot 2024-03-07 at 10 50 23 AM

Copy link

github-actions bot commented Mar 7, 2024

Visit the preview URL for this PR (updated for commit 4e71b5d):

https://mmp-site-b1c9b--pr34-navbar-init-h7jsomls.web.app

(expires Thu, 14 Mar 2024 16:05:54 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 4eb870c89e876f1812e204af417359065d2a23b1

@hetd54 hetd54 marked this pull request as ready for review March 7, 2024 16:12
Copy link

@broarr broarr left a comment

Choose a reason for hiding this comment

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

This looks great! Thank you!

Comment on lines +7 to +28
<script>
class NavbarHamburger extends HTMLElement {
constructor() {
super()

let isHidden = true
const button = this.querySelector("button")
const menuElement: HTMLElement = document.getElementById("#menu-body")!
button?.addEventListener("click", () => {
isHidden = !isHidden
if (isHidden) {
menuElement.style.display = "none"
} else {
menuElement.style.display = "inherit"
}
})
}
}

customElements.define("navbar-hamburger", NavbarHamburger)

</script>
Copy link

Choose a reason for hiding this comment

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

This is neat, is this how Astro recommends doing things? I would have done this with straight css

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That is how you add event listeners with astro!

Copy link

Choose a reason for hiding this comment

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

https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements

I wonder it there are any real differences between web components and astro components

Copy link
Collaborator

@anna-murphy anna-murphy Mar 11, 2024

Choose a reason for hiding this comment

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

My understanding is that there's very little difference!

@hetd54 hetd54 merged commit edf7cea into main Mar 7, 2024
2 checks passed
@hetd54 hetd54 deleted the navbar-init branch March 7, 2024 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants