Add section IDs and smooth scrolling for improved navigation:
- Updated components (`Hero`, `Welcome`, `EventsGrid`, `ImageCarousel`, `Drinks`) to accept optional `id` props and applied them to `<section>` elements. - Enabled smooth scrolling by adding `scroll-behavior: smooth` to global styles. - Enhanced dropdown menu: added internal links for section navigation and adjusted styling for improved responsiveness. - Updated color handling in `ImageCarousel` to use CSS variables for better theme consistency.
This commit is contained in:
@ -1,7 +1,9 @@
|
|||||||
---
|
---
|
||||||
import "../../styles/components/Drinks.css"
|
import "../../styles/components/Drinks.css"
|
||||||
|
|
||||||
|
const { id } = Astro.props;
|
||||||
---
|
---
|
||||||
<section class="Drinks">
|
<section id={id} class="Drinks">
|
||||||
<h2 class="title">Drinks</h2>
|
<h2 class="title">Drinks</h2>
|
||||||
|
|
||||||
<a href="/pdf/Menu.pdf" class="card-link" target="_blank" rel="noopener noreferrer">Getränkekarte</a>
|
<a href="/pdf/Menu.pdf" class="card-link" target="_blank" rel="noopener noreferrer">Getränkekarte</a>
|
||||||
|
|||||||
@ -8,11 +8,12 @@ interface Event {
|
|||||||
date: Date;
|
date: Date;
|
||||||
description: string;
|
description: string;
|
||||||
}
|
}
|
||||||
const { events = [] }: { events?: Event[] } = Astro.props as { events?: Event[] };
|
const { events = [], id }: { events?: Event[], id?: string } = Astro.props as { events?: Event[], id?: string };
|
||||||
import '../../styles/components/EventsGrid.css';
|
import '../../styles/components/EventsGrid.css';
|
||||||
---
|
---
|
||||||
|
|
||||||
<section class="events-gird container">
|
<section id={id} class="events-gird container">
|
||||||
|
<h2 class="section-title">Events</h2>
|
||||||
|
|
||||||
{events.map((event: Event) => (
|
{events.map((event: Event) => (
|
||||||
|
|
||||||
|
|||||||
@ -20,12 +20,17 @@ import "../../styles/components/Header.css"
|
|||||||
<a href="/" class="dropdbtn">Home</a>
|
<a href="/" class="dropdbtn">Home</a>
|
||||||
|
|
||||||
<div class="dropdown-content">
|
<div class="dropdown-content">
|
||||||
|
<!-- Section navigation links -->
|
||||||
|
<a href="/#hero">Home</a>
|
||||||
|
<a href="/#welcome">Willkommen</a>
|
||||||
|
<a href="/#events">Events</a>
|
||||||
|
<a href="/#gallery">Galerie</a>
|
||||||
|
<a href="/#drinks">Drinks</a>
|
||||||
|
|
||||||
<a href="/events">Events</a>
|
<!-- Page navigation links -->
|
||||||
<a href="/gallery">Gallery</a>
|
<a href="/events">Events Page</a>
|
||||||
|
<a href="/gallery">Gallery Page</a>
|
||||||
<a href="/openings">Openings</a>
|
<a href="/openings">Openings</a>
|
||||||
<a href="/drinks">Drinks</a>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
---
|
---
|
||||||
// src/components/Hero.astro
|
// src/components/Hero.astro
|
||||||
import "../../styles/components/Hero.css"
|
import "../../styles/components/Hero.css"
|
||||||
|
|
||||||
|
const { id } = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
<section class="hero container">
|
<section id={id} class="hero container">
|
||||||
|
|
||||||
<div class="hero-overlay">
|
<div class="hero-overlay">
|
||||||
|
|
||||||
|
|||||||
@ -7,10 +7,10 @@ interface Image {
|
|||||||
alt: string;
|
alt: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { images = [] } = Astro.props as { images: Image[] };
|
const { images = [], id } = Astro.props as { images: Image[], id?: string };
|
||||||
---
|
---
|
||||||
|
|
||||||
<section class="image-carousel-container">
|
<section id={id} class="image-carousel-container">
|
||||||
<h2 class="section-title">Galerie</h2>
|
<h2 class="section-title">Galerie</h2>
|
||||||
<div class="image-carousel">
|
<div class="image-carousel">
|
||||||
<button class="nav-button prev-button" aria-label="Previous image">
|
<button class="nav-button prev-button" aria-label="Previous image">
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
---
|
---
|
||||||
// src/components/Welcome.astro
|
// src/components/Welcome.astro
|
||||||
import "../../styles/components/Welcome.css"
|
import "../../styles/components/Welcome.css"
|
||||||
|
|
||||||
|
const { id } = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
<section class="welcome container">
|
<section id={id} class="welcome container">
|
||||||
|
|
||||||
<div class="welcome-text">
|
<div class="welcome-text">
|
||||||
|
|
||||||
|
|||||||
@ -31,9 +31,9 @@ const images = [
|
|||||||
|
|
||||||
<Layout>
|
<Layout>
|
||||||
|
|
||||||
<Hero />
|
<Hero id="hero" />
|
||||||
<Welcome />
|
<Welcome id="welcome" />
|
||||||
<EventsGrid events={events} />
|
<EventsGrid id="events" events={events} />
|
||||||
<ImageCarousel images={images} />
|
<ImageCarousel id="gallery" images={images} />
|
||||||
<Drinks />
|
<Drinks id="drinks" />
|
||||||
</Layout>
|
</Layout>
|
||||||
|
|||||||
@ -1,3 +1,11 @@
|
|||||||
|
.section-title {
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 1.5rem;
|
||||||
|
font-size: 2rem;
|
||||||
|
font-weight: bold;
|
||||||
|
color: var(--color-text);
|
||||||
|
}
|
||||||
|
|
||||||
.events-gird {
|
.events-gird {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
|||||||
@ -61,10 +61,12 @@
|
|||||||
display: none;
|
display: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
background-color: #0e0c0c;
|
background-color: #0e0c0c;
|
||||||
min-width: 160px;
|
min-width: 200px;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
border: 1px solid #444;
|
border: 1px solid #444;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
|
max-height: 400px;
|
||||||
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dropdown-content a {
|
.dropdown-content a {
|
||||||
@ -91,4 +93,41 @@
|
|||||||
.nav-links {
|
.nav-links {
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.nav-main {
|
||||||
|
margin-right: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo {
|
||||||
|
margin-left: 1em;
|
||||||
|
height: 3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown-content {
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 480px) {
|
||||||
|
.header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo {
|
||||||
|
margin-left: 0.5em;
|
||||||
|
height: 2.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-main {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-main a,
|
||||||
|
.dropdbtn {
|
||||||
|
margin: 0 0.5rem;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
margin-bottom: 1.5rem;
|
margin-bottom: 1.5rem;
|
||||||
font-size: 2rem;
|
font-size: 2rem;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: #333;
|
color: var(--color-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
.image-carousel {
|
.image-carousel {
|
||||||
|
|||||||
@ -5,6 +5,11 @@
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Add smooth scrolling behavior */
|
||||||
|
html {
|
||||||
|
scroll-behavior: smooth;
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: var(--font-family-primary);
|
font-family: var(--font-family-primary);
|
||||||
background-color: var(--color-background);
|
background-color: var(--color-background);
|
||||||
|
|||||||
Reference in New Issue
Block a user