diff --git a/.yarn/install-state.gz b/.yarn/install-state.gz index e04e4258..9795a877 100644 Binary files a/.yarn/install-state.gz and b/.yarn/install-state.gz differ diff --git a/package.json b/package.json index 27c89d51..b8d36402 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "@fontsource/baskervville": "^5.0.19", "@hookform/resolvers": "^3.3.4", "@million/lint": "^0.0.73", - "@types/node": "^20.11.30", + "@types/node": "^20.12.2", "@types/react": "^18.2.73", "@types/react-dom": "^18.2.23", "astro": "^4.5.12", @@ -71,7 +71,7 @@ "@testing-library/react-hooks": "^8.0.1", "@types/eslint": "^8.56.6", "@types/markdown-it": "^13.0.7", - "@types/three": "^0.162.0", + "@types/three": "^0.163.0", "@typescript-eslint/eslint-plugin": "^7.4.0", "@typescript-eslint/parser": "^7.4.0", "eslint": "^8.57.0", diff --git a/src/pages/index.astro b/src/pages/index.astro index 413e3c1f..f2621157 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -24,8 +24,6 @@ import LatestArticles from '@components/organisms/latestArticles/LatestArticles. // todo: improve isolation // todo: add thinner svg lines // todo: reduce XXSS module -// todo: fix box shadow on load (https://css-tricks.com/fixing-box-shadow-z-index-bug/) -// todo: use scroll-driven animations to add box shadow on header when scroll // todo: replace arrows and icons for a finest ones // todo: refer logo (original + finet) // todo: add vitest diff --git a/src/ui/components/atoms/logo/logo.css b/src/ui/components/atoms/logo/logo.css index 90df89a8..3ad5f569 100644 --- a/src/ui/components/atoms/logo/logo.css +++ b/src/ui/components/atoms/logo/logo.css @@ -1,5 +1,8 @@ @layer header.logo { .site__logo { + animation: shrink linear both; + animation-range: 0 5vw; + animation-timeline: scroll(); display: block; height: fit-content; inset: 1rem 0 0; @@ -7,17 +10,18 @@ position: absolute; transition: top 0.3s linear 1.75s, - scale 0.2s; + scale 0.2s linear 0.3s, + transform 0.2s linear; width: 307px; z-index: 20; svg { transition: - scale 0.2s, - fill 0.3s; + top 0.3s linear 1.75s, + scale 0.2s linear; } - &.--is-scrolling:not(.--is-menu-open) svg { + :not(.--is-menu-open) svg { scale: 0.85; } } diff --git a/src/ui/components/organisms/header/header.css b/src/ui/components/organisms/header/header.css index 09c6aca3..51cc4c96 100644 --- a/src/ui/components/organisms/header/header.css +++ b/src/ui/components/organisms/header/header.css @@ -1,5 +1,8 @@ @layer header { .header { + animation: add-shadow linear both; + animation-range: 0 1vw; + animation-timeline: scroll(); height: var(--header-height); margin-inline: auto; position: fixed; @@ -8,12 +11,8 @@ width: 100%; z-index: 1000; - &.--is-scrolling { - box-shadow: 0 0.125rem 0.375rem var(--neutral-light-2); - - &::after { - clip-path: polygon(0 0, 100% 0, 100% 120%, 0 120%); - } + &::after { + clip-path: polygon(0 0, 100% 0, 100% 120%, 0 120%); } .header__wrapper { diff --git a/src/ui/components/organisms/header/utils/scrollDirection/index.ts b/src/ui/components/organisms/header/utils/scrollDirection/index.ts deleted file mode 100644 index bee0c5c1..00000000 --- a/src/ui/components/organisms/header/utils/scrollDirection/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './scrollDirection'; diff --git a/src/ui/components/organisms/header/utils/scrollDirection/scrollDirection.ts b/src/ui/components/organisms/header/utils/scrollDirection/scrollDirection.ts deleted file mode 100644 index f40dba29..00000000 --- a/src/ui/components/organisms/header/utils/scrollDirection/scrollDirection.ts +++ /dev/null @@ -1,33 +0,0 @@ -enum ScrollDirection { - NONE = 'NONE', - UP = 'UP', - DOWN = 'DOWN', -} - -export function scrollDirection(): void { - let lastScrollTop = 0; - let scrollDirection: ScrollDirection = ScrollDirection.NONE; - - function handleScroll() { - const HEADER = document.querySelector('header'); - const LOGO = document.querySelector('.site__logo'); - const scrollTop = document.documentElement.scrollTop ?? document.body.scrollTop; - - if (scrollTop > lastScrollTop) scrollDirection = ScrollDirection.DOWN; - else scrollDirection = ScrollDirection.UP; - - lastScrollTop = scrollTop; - - if (!HEADER || !LOGO) return; - - if (scrollTop === 0) { - HEADER.classList.remove('--is-scrolling'); - LOGO.classList.remove('--is-scrolling'); - } else if (scrollDirection === ScrollDirection.DOWN) { - HEADER.classList.add('--is-scrolling'); - LOGO.classList.add('--is-scrolling'); - } - } - - window.addEventListener('scroll', handleScroll); -} diff --git a/src/ui/components/organisms/header/utils/toggleMenu/toggleMenu.ts b/src/ui/components/organisms/header/utils/toggleMenu/toggleMenu.ts index cf0d931d..9827d164 100644 --- a/src/ui/components/organisms/header/utils/toggleMenu/toggleMenu.ts +++ b/src/ui/components/organisms/header/utils/toggleMenu/toggleMenu.ts @@ -96,7 +96,7 @@ export function toggleMenu() { }, '<' ); - timeline.to(SITE_LOGO, { y: '3rem', duration: 0.25 }, '-=0.5'); + timeline.to(SITE_LOGO, { y: '2rem', duration: 0.25 }, '-=0.5'); timeline.to(SITE_LOGO_SVG, { fill: WHITE, duration: 0.25 }, '-=1'); timeline .to(OVERLAY_PATH, { attr: { d: PATH_START }, ease: POWER2_EASE_IN, duration: 1 }, '<') diff --git a/src/ui/components/organisms/siteHead/SiteHead.astro b/src/ui/components/organisms/siteHead/SiteHead.astro index 9f3a327a..d1340dbf 100644 --- a/src/ui/components/organisms/siteHead/SiteHead.astro +++ b/src/ui/components/organisms/siteHead/SiteHead.astro @@ -39,8 +39,7 @@ const { title, description, image = '/blog-placeholder-1.jpg' } = Astro.props as +>