add mobile nav
This commit is contained in:
parent
ff6b723b11
commit
84dde04352
@ -38,9 +38,14 @@ export interface Props
|
|||||||
extends HTMLAttributes<"button">,
|
extends HTMLAttributes<"button">,
|
||||||
VariantProps<typeof button> {}
|
VariantProps<typeof button> {}
|
||||||
|
|
||||||
const { variant = "default", size = "default", ...props } = Astro.props;
|
const {
|
||||||
|
variant = "default",
|
||||||
|
size = "default",
|
||||||
|
class: className,
|
||||||
|
...props
|
||||||
|
} = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
<button {...props} class={button({ variant, size })}>
|
<button {...props} class={button({ variant, size, class: className })}>
|
||||||
<slot />
|
<slot />
|
||||||
</button>
|
</button>
|
||||||
|
@ -1,8 +1,13 @@
|
|||||||
---
|
---
|
||||||
import { button } from "../Button.astro";
|
import Button, { button } from "../Button.astro";
|
||||||
|
import { Menu } from "lucide-astro";
|
||||||
---
|
---
|
||||||
|
|
||||||
<header id="header" class="fixed top-0 w-full h-[100px] z-50 bg-neutral-accent">
|
<header id="header" class="fixed top-0 w-full h-[100px] z-50">
|
||||||
|
<div
|
||||||
|
class="bg-neutral-accent/90 w-full h-full absolute -z-20 backdrop-blur-lg"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
class="flex flex-row justify-between h-full w-full max-w-section m-auto p-main"
|
class="flex flex-row justify-between h-full w-full max-w-section m-auto p-main"
|
||||||
>
|
>
|
||||||
@ -11,11 +16,39 @@ import { button } from "../Button.astro";
|
|||||||
<h2 class="text-3xl font-extrabold">vspace.one</h2>
|
<h2 class="text-3xl font-extrabold">vspace.one</h2>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-row gap-2 items-center">
|
<Button variant="default" class="lg:hidden" id="nav-button">
|
||||||
|
<Menu />
|
||||||
|
</Button>
|
||||||
|
<div
|
||||||
|
id="nav-mobile"
|
||||||
|
class="animate-in slide-in-from-top-10 ease-out-quart duration-1000 absolute top-[100px] w-full
|
||||||
|
bg-neutral p-main left-0 hidden flex flex-col gap-3 -z-30"
|
||||||
|
>
|
||||||
<a class={button({ variant: "secondary", size: "lg" })} href="/#location"
|
<a class={button({ variant: "secondary", size: "lg" })} href="/#location"
|
||||||
>Standort</a
|
>Standort</a
|
||||||
>
|
>
|
||||||
<a class={button({ variant: "secondary", size: "lg" })} href="/faq">FAQ</a
|
<a
|
||||||
|
class={button({
|
||||||
|
variant: "secondary",
|
||||||
|
size: "lg",
|
||||||
|
})}
|
||||||
|
href="/faq">FAQ</a
|
||||||
|
>
|
||||||
|
<a class={button({ variant: "primary", size: "lg" })} href="/support"
|
||||||
|
>Unterstütze uns!</a
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-row gap-2 items-center max-lg:hidden">
|
||||||
|
<a class={button({ variant: "secondary", size: "lg" })} href="/#location"
|
||||||
|
>Standort</a
|
||||||
|
>
|
||||||
|
<a
|
||||||
|
class={button({
|
||||||
|
variant: "secondary",
|
||||||
|
size: "lg",
|
||||||
|
class: "max-md:hidden",
|
||||||
|
})}
|
||||||
|
href="/faq">FAQ</a
|
||||||
>
|
>
|
||||||
<a class={button({ variant: "primary", size: "lg" })} href="/support"
|
<a class={button({ variant: "primary", size: "lg" })} href="/support"
|
||||||
>Unterstütze uns!</a
|
>Unterstütze uns!</a
|
||||||
@ -23,3 +56,34 @@ import { button } from "../Button.astro";
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { animate, spring, stagger } from "motion";
|
||||||
|
|
||||||
|
const button = document.getElementById("nav-button")!;
|
||||||
|
const navMobile = document.getElementById("nav-mobile")!;
|
||||||
|
const navButtons = navMobile.children;
|
||||||
|
|
||||||
|
button.addEventListener("click", () => {
|
||||||
|
if (navMobile.classList.contains("hidden")) {
|
||||||
|
animate(
|
||||||
|
navButtons as unknown as NodeListOf<any>,
|
||||||
|
{
|
||||||
|
y: [-30, 0],
|
||||||
|
scale: [0.8, 1],
|
||||||
|
opacity: [0, 1],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
easing: spring({
|
||||||
|
stiffness: 200,
|
||||||
|
damping: 20,
|
||||||
|
mass: 1,
|
||||||
|
}),
|
||||||
|
delay: stagger(0.1),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
navMobile.classList.toggle("hidden");
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@ -9,10 +9,11 @@ import "pannellum/build/pannellum.css";
|
|||||||
<div
|
<div
|
||||||
id="landing-heading-container"
|
id="landing-heading-container"
|
||||||
style="opacity: 0;"
|
style="opacity: 0;"
|
||||||
class="flex flex-col justify-center items-center gap-2 backdrop-blur-2xl p-card rounded-card ring ring-primary/20"
|
class="flex flex-col justify-center items-center gap-2 backdrop-blur-2xl p-card rounded-card ring ring-primary/20
|
||||||
|
max-md:w-[90vw]"
|
||||||
>
|
>
|
||||||
<!--h1>vspace.one</h1-->
|
<!--h1>vspace.one</h1-->
|
||||||
<h2 class="text-4xl">Ein Makerspace und Hackerspace</h2>
|
<h2 class="text-4xl text-center">Ein Makerspace und Hackerspace</h2>
|
||||||
<p>
|
<p>
|
||||||
<a class="text-xl" href="/tour">Hier gehts zur virtuellen Space-Tour!</a
|
<a class="text-xl" href="/tour">Hier gehts zur virtuellen Space-Tour!</a
|
||||||
>
|
>
|
||||||
@ -20,7 +21,7 @@ import "pannellum/build/pannellum.css";
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="w-full h-full">
|
<div class="w-full h-full">
|
||||||
<div class="w-full h-full" id="pano-bg"></div>
|
<div style="opacity: 0;" class="w-full h-full" id="pano-bg"></div>
|
||||||
<!--little-planet
|
<!--little-planet
|
||||||
width="2400"
|
width="2400"
|
||||||
height="900"
|
height="900"
|
||||||
@ -36,68 +37,61 @@ import "pannellum/build/pannellum.css";
|
|||||||
import { animate } from "motion";
|
import { animate } from "motion";
|
||||||
import { ease } from "@unom/style";
|
import { ease } from "@unom/style";
|
||||||
|
|
||||||
const viewer = pannellum.viewer("pano-bg", {
|
const init = () => {
|
||||||
panorama: "/pic/panorama/maschinenraum_half.jpg",
|
const panoBg = document.getElementById("pano-bg")!;
|
||||||
autoLoad: true,
|
|
||||||
showControls: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
viewer.setYaw(90, true);
|
const viewer = pannellum.viewer(panoBg, {
|
||||||
|
panorama: "/pic/panorama/maschinenraum_half.jpg",
|
||||||
const animateEntry = () => {
|
autoLoad: true,
|
||||||
let scene: any = document.querySelector("little-planet.anim")!;
|
showControls: false,
|
||||||
const landingHeadingContainer = document.querySelector(
|
|
||||||
"#landing-heading-container",
|
|
||||||
)!;
|
|
||||||
|
|
||||||
console.log(scene.children);
|
|
||||||
|
|
||||||
scene.addEventListener("load", () => {
|
|
||||||
animate(
|
|
||||||
scene,
|
|
||||||
{ scale: [0.9, 1], opacity: [0, 1] },
|
|
||||||
{
|
|
||||||
...ease.quint!(1.5).out,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
animate(
|
|
||||||
landingHeadingContainer,
|
|
||||||
{ scale: [0.4, 1], opacity: [0, 1] },
|
|
||||||
{
|
|
||||||
...ease.quint!(1.4, 0.2).out,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
animate(
|
|
||||||
(progress) => {
|
|
||||||
scene.camera = {
|
|
||||||
lon: -180 + ((progress * 270) % 360),
|
|
||||||
lat: progress * 10,
|
|
||||||
fov: 20 + 50 * progress,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
{
|
|
||||||
...ease.quint!(4).inOut,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
/** spring({
|
|
||||||
stiffness: 10,
|
|
||||||
damping: 40,
|
|
||||||
mass: 2,
|
|
||||||
restSpeed: 0.01,
|
|
||||||
restDistance: 0.001,
|
|
||||||
}) */
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
viewer.setYaw(90, false);
|
||||||
|
|
||||||
|
const animateEntry = () => {
|
||||||
|
const landingHeadingContainer = document.querySelector(
|
||||||
|
"#landing-heading-container",
|
||||||
|
)!;
|
||||||
|
|
||||||
|
viewer.on("load", () => {
|
||||||
|
console.log("loaded");
|
||||||
|
|
||||||
|
animate(
|
||||||
|
panoBg,
|
||||||
|
{ scale: [0.9, 1], opacity: [0, 1] },
|
||||||
|
{
|
||||||
|
...ease.quint!(1.5).out,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
animate(
|
||||||
|
landingHeadingContainer,
|
||||||
|
{ scale: [0.4, 1], opacity: [0, 1] },
|
||||||
|
{
|
||||||
|
...ease.quint!(1.4, 0.2).out,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
animate(
|
||||||
|
(progress) => {
|
||||||
|
viewer.setPitch(progress * 10, false);
|
||||||
|
viewer.setYaw(160 + ((progress * 270) % 360), false);
|
||||||
|
viewer.setHfov(50 + progress * 50, false);
|
||||||
|
},
|
||||||
|
{
|
||||||
|
...ease.quint!(4).inOut,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
animateEntry();
|
||||||
};
|
};
|
||||||
|
|
||||||
animateEntry();
|
init();
|
||||||
|
|
||||||
document.addEventListener("astro:after-swap", () => {
|
document.addEventListener("astro:after-swap", () => {
|
||||||
animateEntry();
|
init();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<script is:inline type="module" src="https://unpkg.com/little-planet@0.5"
|
|
||||||
></script>
|
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user