0.0.7 • Published 2 years ago

astro-headers v0.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

🚀 Astro headers

📘 Documentation →

🧑‍🚀 Astro website →

Collection of headers for astro.

You can find a live usage at astros.warps.it.

Headers included

NameDescription
HeaderDefault header

Header

How To Use

---
...
/* Import the header you need */
import { Header } from "../index.js";
import routes from "../data/routes.json";

interface Props {
	pathname?: string;
}

const { pathname } = Astro.props as Props;
---

<html lang="en">
	<head>
	</head>
	<head>
		<body>
			<Header
				logo="your-logo.png"
				{pathname}
				navItems={routes}
				sticky={true}
				hideOnScroll={true}
			/>
			<main></main>
		</body>
	</head>
</html>

navItems should be an array of objects with the following properties:

[
	{
		"title": "Home",
		"href": "/",
		"type": "link"
	},
	{
		"title": "Services",
		"href": "/services",
		"type": "link",
		"items": [
			{
				"title": "Service 1",
				"href": "/service1",
				"type": "link"
			},
			{
				"title": "Service 2",
				"href": "/service2",
				"type": "link"
			}
		]
	},
	{
		"title": "About",
		"href": "/about",
		"type": "link"
	},
	{
		"title": "Blog",
		"href": "/blog",
		"type": "link"
	},
	{
		"title": "Contacts",
		"href": "/contact",
		"type": "button"
	}
]

Supported Props

PropnameTypeDefaultRequiredDescription
navItemsNavItem[]nullXItems of the navbar (view above)
pathnamestringnullXPath of the current page, set with pathname={Astro.request.url.pathname}
stickybooltrueSet the header as sticky (will follow throught the page)
blurbooltrueBlur the header (for desktop only)
hideOnScrollbooltrueHide the header when scrolling down
logostringnullPath of the logo image
showThemeSwitcherbooltrueShow the theme switcher
showLanguageSwitcherbooltrueShow the language switcher
hamburgerStylestring"minimal""Minimal" / "Fancy", layout for the hamburger style
lmapstringnullLanguage map, required for localize labels on the header
0.0.5

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago