From b4ae9093bc3f0bdf7a45f86f3ba4ab8293170955 Mon Sep 17 00:00:00 2001 From: Melvin Ragusa Date: Wed, 21 Jan 2026 23:05:37 +0100 Subject: [PATCH] feat: add scroll indicator with animation and translations --- src/components/sections/Hero.module.css | 16 ++++++++++++- src/components/sections/Hero.tsx | 32 ++++++++++++++++++++----- src/i18n/de.ts | 1 + src/i18n/en.ts | 1 + 4 files changed, 43 insertions(+), 7 deletions(-) diff --git a/src/components/sections/Hero.module.css b/src/components/sections/Hero.module.css index 7822f18..388eec8 100644 --- a/src/components/sections/Hero.module.css +++ b/src/components/sections/Hero.module.css @@ -3,7 +3,8 @@ display: flex; align-items: center; justify-content: center; - min-height: 100vh; + height: 100vh; + height: 100dvh; padding: var(--space-3xl) 0; overflow: hidden; } @@ -105,6 +106,10 @@ left: 50%; transform: translateX(-50%); z-index: 1; + display: flex; + flex-direction: column; + align-items: center; + gap: var(--space-sm); } .scrollMouse { @@ -124,6 +129,15 @@ border-radius: 2px; } +.scrollText { + font-size: 0.75rem; + font-weight: 500; + color: var(--md-sys-color-on-surface); + opacity: 0.4; + text-transform: uppercase; + letter-spacing: 0.1em; +} + @media (max-width: 768px) { .typed { min-width: auto; diff --git a/src/components/sections/Hero.tsx b/src/components/sections/Hero.tsx index 0b9a38e..7800eae 100644 --- a/src/components/sections/Hero.tsx +++ b/src/components/sections/Hero.tsx @@ -1,3 +1,4 @@ +import { useState, useEffect } from 'react'; import { Link } from 'react-router-dom'; import { motion } from 'motion/react'; import { useTranslation } from '../../i18n'; @@ -8,6 +9,16 @@ import styles from './Hero.module.css'; export function Hero() { const { t } = useTranslation(); + const [showScrollIndicator, setShowScrollIndicator] = useState(true); + + useEffect(() => { + const handleScroll = () => { + setShowScrollIndicator(window.scrollY < 50); + }; + + window.addEventListener('scroll', handleScroll, { passive: true }); + return () => window.removeEventListener('scroll', handleScroll); + }, []); const { text } = useTypingEffect({ words: t.hero.rotatingWords, @@ -78,15 +89,24 @@ export function Hero() { -
+ {showScrollIndicator && ( - + + + + {t.hero.scroll} -
+ )} ); } diff --git a/src/i18n/de.ts b/src/i18n/de.ts index 564d89a..020fe57 100644 --- a/src/i18n/de.ts +++ b/src/i18n/de.ts @@ -14,6 +14,7 @@ export const de = { rotatingWords: ['Webentwicklung', 'IT-Support', 'Digitale Lösungen', 'Tech-Beratung'], cta: 'Projekt starten', ctaSecondary: 'Mehr erfahren', + scroll: 'Scrollen', }, // Services diff --git a/src/i18n/en.ts b/src/i18n/en.ts index 281ce84..d6af140 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -16,6 +16,7 @@ export const en: Translations = { rotatingWords: ['Web Development', 'IT Support', 'Digital Solutions', 'Tech Consulting'], cta: 'Start Project', ctaSecondary: 'Learn More', + scroll: 'Scroll', }, // Services