-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use alternative teleport path for correct SSR
- Loading branch information
1 parent
9f9ef1f
commit f5d5d00
Showing
5 changed files
with
141 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,78 @@ | ||
<script setup> | ||
import { Bars3Icon, XMarkIcon } from '@heroicons/vue/24/outline' | ||
import { Bars3Icon, XMarkIcon } from '@heroicons/vue/24/outline' | ||
const route = useRoute() | ||
const route = useRoute() | ||
const { value: isMenuActive, toggle: toggleMenu } = useMenu() | ||
const { value: isMenuActive, toggle: toggleMenu } = useMenu() | ||
const isPageWithLogoDisabled = computed(() => { | ||
switch (route.path) { | ||
case '/': | ||
return true | ||
const isPageWithLogoDisabled = computed(() => { | ||
switch (route.path) { | ||
case '/': | ||
return true | ||
default: | ||
return false | ||
} | ||
}) | ||
default: | ||
return false | ||
} | ||
}) | ||
</script> | ||
|
||
<template> | ||
<nav> | ||
<!-- --> | ||
<nav> | ||
<!-- --> | ||
|
||
<!-- Container --> | ||
<div class='container mx-auto max-w-3xl sm:px-6 lg:px-8'> | ||
<!-- --> | ||
<!-- Container --> | ||
<div class="container mx-auto max-w-3xl sm:px-6 lg:px-8"> | ||
<!-- --> | ||
|
||
<!-- Navbar --> | ||
<div class='relative flex h-14 items-center justify-between'> | ||
<!-- --> | ||
<!-- Navbar --> | ||
<div class="relative flex h-14 items-center justify-between"> | ||
<!-- --> | ||
|
||
<!-- Right side: Menu button --> | ||
<div class='absolute inset-y-0 left-0 flex items-center pl-2'> | ||
<button | ||
class='hover:hover-text-util focus-visible:focus-outline-util hover:hover-bg-util inline-flex items-center justify-center rounded-md p-2 text-base-content-highlight focus-visible:ring-inset' | ||
type='button' | ||
@click='toggleMenu()' | ||
> | ||
<span class='sr-only'>Open main menu</span> | ||
<!-- Right side: Menu button --> | ||
<div class="absolute inset-y-0 left-0 flex items-center pl-2"> | ||
<button | ||
class="hover:hover-text-util focus-visible:focus-outline-util hover:hover-bg-util inline-flex items-center justify-center rounded-md p-2 text-base-content-highlight focus-visible:ring-inset" | ||
type="button" | ||
@click="toggleMenu()" | ||
> | ||
<span class="sr-only">Open main menu</span> | ||
|
||
<Bars3Icon | ||
v-if='!isMenuActive' | ||
class='block h-6 w-6' | ||
/> | ||
<Bars3Icon | ||
v-if="!isMenuActive" | ||
class="block h-6 w-6" | ||
/> | ||
|
||
<XMarkIcon | ||
v-else | ||
class='block h-6 w-6' | ||
/> | ||
</button> | ||
</div> | ||
<XMarkIcon | ||
v-else | ||
class="block h-6 w-6" | ||
/> | ||
</button> | ||
</div> | ||
|
||
<!-- Center: Logo --> | ||
<div class='flex flex-1 items-center justify-center'> | ||
<NuxtLink | ||
v-if='!isPageWithLogoDisabled' | ||
class='focus-visible:focus-outline-util flex-shrink-0' | ||
to='/' | ||
> | ||
<img | ||
alt='Icon' | ||
class='flip-vertical-fwd h-6 w-6 text-base-content-highlight' | ||
height='16' | ||
loading='eager' | ||
src='/icon.svg' | ||
width='16' | ||
/> | ||
</NuxtLink> | ||
</div> | ||
<!-- Center: Logo --> | ||
<div class="flex flex-1 items-center justify-center"> | ||
<NuxtLink | ||
v-if="!isPageWithLogoDisabled" | ||
class="focus-visible:focus-outline-util flex-shrink-0" | ||
to="/" | ||
> | ||
<img | ||
alt="Icon" | ||
class="flip-vertical-fwd h-6 w-6 text-base-content-highlight" | ||
height="16" | ||
loading="eager" | ||
src="/icon.svg" | ||
width="16" | ||
/> | ||
</NuxtLink> | ||
</div> | ||
|
||
<!-- Right side: Actions --> | ||
<TeleportTarget | ||
id='navbar-actions' | ||
class='absolute inset-y-0 right-0 flex flex-row-reverse items-center pr-2' | ||
> | ||
</TeleportTarget> | ||
</div> | ||
</div> | ||
</nav> | ||
<!-- Right side: Actions --> | ||
<TeleportTarget | ||
id="navbar-actions" | ||
class="absolute inset-y-0 right-0 flex flex-row-reverse items-center pr-2" | ||
/> | ||
</div> | ||
</div> | ||
</nav> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters