feat: hero effect with dynamic navbar height and inline title
All checks were successful
Build Docker Image / build (push) Successful in 3m41s
All checks were successful
Build Docker Image / build (push) Successful in 3m41s
This commit is contained in:
@@ -8,24 +8,10 @@
|
||||
<div class="absolute inset-0 bg-[radial-gradient(ellipse_at_center,_var(--tw-gradient-stops))] from-primary/20 via-transparent to-transparent" />
|
||||
</template>
|
||||
|
||||
<!-- Hero title (home page only, fades on scroll) -->
|
||||
<div
|
||||
v-if="isHomePage"
|
||||
class="absolute left-0 right-0 text-center pointer-events-none z-20"
|
||||
:style="heroTitleStyle"
|
||||
>
|
||||
<h1 class="text-4xl lg:text-5xl font-bold text-white mb-2">
|
||||
{{ $t('hero.title', 'Оптовая торговля') }}
|
||||
</h1>
|
||||
<p class="text-lg text-white/70">
|
||||
{{ $t('hero.subtitle', 'Найдите лучших поставщиков и товары') }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- MainNavigation - same everywhere, centered vertically on home page -->
|
||||
<!-- MainNavigation - dynamic height on home page -->
|
||||
<MainNavigation
|
||||
class="relative z-10"
|
||||
:style="mainNavStyle"
|
||||
:height="isHomePage ? heroHeight : 100"
|
||||
:session-checked="sessionChecked"
|
||||
:logged-in="isLoggedIn"
|
||||
:user-avatar-svg="userAvatarSvg"
|
||||
@@ -58,7 +44,19 @@
|
||||
@update:search-query="searchQuery = $event"
|
||||
@update-quantity="setQuantity"
|
||||
@search="onSearch"
|
||||
/>
|
||||
>
|
||||
<!-- Hero content for home page -->
|
||||
<template v-if="isHomePage && collapseProgress < 1" #hero>
|
||||
<div class="text-center mb-4" :style="{ opacity: 1 - collapseProgress }">
|
||||
<h1 class="text-4xl lg:text-5xl font-bold text-white mb-2">
|
||||
{{ $t('hero.title', 'Оптовая торговля') }}
|
||||
</h1>
|
||||
<p class="text-lg text-white/70">
|
||||
{{ $t('hero.subtitle', 'Найдите лучших поставщиков и товары') }}
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
</MainNavigation>
|
||||
|
||||
<!-- Sub Navigation (section-specific tabs) - only for non-catalog/non-home sections -->
|
||||
<SubNavigation
|
||||
@@ -177,12 +175,8 @@ const hasSubNav = computed(() => !isHomePage.value && !isCatalogSection.value)
|
||||
const canCollapse = computed(() => hasSubNav.value)
|
||||
const isHeaderCollapsed = computed(() => canCollapse.value && isCollapsed.value)
|
||||
|
||||
// Header container style - dynamic height for home page, transform for SubNav pages
|
||||
// Header container style - transform for SubNav pages
|
||||
const headerContainerStyle = computed(() => {
|
||||
if (isHomePage.value) {
|
||||
// Home page: height changes from heroHeight to 100px on scroll
|
||||
return { height: `${heroHeight.value}px` }
|
||||
}
|
||||
if (hasSubNav.value) {
|
||||
// SubNav pages: slide up on scroll
|
||||
return { transform: `translateY(${headerOffset.value}px)` }
|
||||
@@ -190,25 +184,6 @@ const headerContainerStyle = computed(() => {
|
||||
return {}
|
||||
})
|
||||
|
||||
// MainNavigation style - centered vertically on home page, normal on other pages
|
||||
const mainNavStyle = computed(() => {
|
||||
if (!isHomePage.value) return {}
|
||||
// Center MainNav (100px) in container: margin-top = (height - 100) / 2
|
||||
const marginTop = Math.max(0, (heroHeight.value - 100) / 2)
|
||||
return { marginTop: `${marginTop}px` }
|
||||
})
|
||||
|
||||
// Hero title style - positioned above MainNav, fades on scroll
|
||||
const heroTitleStyle = computed(() => {
|
||||
// Position title above the centered MainNav
|
||||
const navMarginTop = Math.max(0, (heroHeight.value - 100) / 2)
|
||||
const titleBottom = heroHeight.value - navMarginTop + 20 // 20px gap above nav
|
||||
return {
|
||||
bottom: `${titleBottom}px`,
|
||||
opacity: 1 - collapseProgress.value,
|
||||
transform: `translateY(${collapseProgress.value * -20}px)`
|
||||
}
|
||||
})
|
||||
|
||||
// Main content padding-top to compensate for fixed header
|
||||
const mainStyle = computed(() => {
|
||||
|
||||
Reference in New Issue
Block a user