Skip to content

Commit

Permalink
fix(docs): add transition between docs pages, remove scrollToTop. (ep…
Browse files Browse the repository at this point in the history
  • Loading branch information
Sadnessa authored Nov 18, 2024
1 parent 8844b2a commit cadd046
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
4 changes: 1 addition & 3 deletions packages/docs/layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ watch(() => breakpoints.smDown, (newValue: boolean) => {
})
const { afterEach } = useRouter()
const { scrollToElement } = useDocsScroll()
afterEach(() => {
scrollToElement()
isSidebarVisible.value = !breakpoints.smDown
isOptionsVisible.value = false
})
Expand All @@ -76,7 +74,7 @@ const onMouseMove = (e: MouseEvent) => {
}
onMounted(() => {
scrollToElement()
isSidebarVisible.value = !breakpoints.smDown
setTimeout(() => {
doShowLoader.value = false
Expand Down
19 changes: 15 additions & 4 deletions packages/docs/pages/[page-config-category]/[page].vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="page-config">
<PageConfig
v-if="!isLoading && config"
<PageConfig
v-if="!isLoading && config"
:page-config="config"
/>
<PageConfigSkeleton v-else />
Expand All @@ -12,6 +12,7 @@
import { type ConcreteBlock } from '../../modules/page-config/runtime';
definePageMeta({
pageTransition: { name: 'page', mode: 'out-in' },
layout: 'default',
scrollToTop: true,
// See: https://github.com/nuxt/nuxt/issues/13309
Expand All @@ -31,9 +32,9 @@ const tabTitlePrefix = 'Vuestic UI'
const router = useRouter()
watch(config, () => {
if (!config.value) {
if (!config.value) {
router.push('/404')
}
}
}, { immediate: true })
watchEffect(() => {
Expand All @@ -50,6 +51,16 @@ watchEffect(() => {
</script>

<style lang="scss">
.page-enter-active,
.page-leave-active {
transition: all 0.2s;
}
.page-enter-from,
.page-leave-to {
opacity: 0;
filter: blur(1rem);
}
.page-config-title,
.page-config-subtitle,
.page-config-headline {
Expand Down

0 comments on commit cadd046

Please sign in to comment.