chore: improve responsiveness of header

This commit is contained in:
2025-12-09 22:20:32 +01:00
parent 7fa6c2b8ce
commit 908a4b6c70

View File

@@ -1,4 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
const isLargeScreen = useMediaQuery('(min-width: 1024px)')
const appConfig = useAppConfig() const appConfig = useAppConfig()
const scrollThreshold = ref<number>(0) const scrollThreshold = ref<number>(0)
@@ -28,7 +30,12 @@ const { isScrolled } = useScroll(effectiveScrollThreshold.value)
</header> </header>
<header class="app-header--sticky" v-if="isScrolled"> <header class="app-header--sticky" v-if="isScrolled">
<img src="~/assets/images/brand-desktop.svg" :alt="appConfig.title" /> <img src="~/assets/images/brand-desktop.svg" :alt="appConfig.title" />
<NuxtLink to="#about"> About</NuxtLink>
<nav>
<!-- <NuxtLink v-if="isLargeScreen" to="#top"> Back on top</NuxtLink> -->
<NuxtLink to="#about"> About</NuxtLink>
<NuxtLink v-if="isLargeScreen" to="#contact"> Contact</NuxtLink>
</nav>
</header> </header>
</template> </template>
@@ -83,8 +90,13 @@ const { isScrolled } = useScroll(effectiveScrollThreshold.value)
width: 300px; width: 300px;
} }
a { nav {
display: flex;
gap: 2.5rem;
margin-left: auto; margin-left: auto;
}
a {
font-weight: 500; font-weight: 500;
color: inherit; color: inherit;
} }
@@ -93,4 +105,19 @@ p {
font-size: 1.25rem; font-size: 1.25rem;
line-height: 1.5rem; line-height: 1.5rem;
} }
@media (min-width: 1024px) {
.app-header--sticky {
height: 114px;
padding: 2.6rem 4rem;
}
.app-header--sticky img {
height: 30px;
}
a {
font-size: 1.25rem;
}
}
</style> </style>