* Migrate to Nuxt 3 * Update vercel config * remove tsconfig comment * Changelog experiment + working proj pages * Fix package json * Prevent vercel complaining * fix deploy (hopefully) * Tag generator * Switch to yarn * Vercel pls 🙏 * Fix tag generation bug * Make (most) non-logged in pages work * fix base build * Linting + state * Eradicate axios, make most user pages work * Fix checkbox state being set incorrectly * Make most things work * Final stretch * Finish (most) things * Move to update model value * Fix modal text getting blurred from transforms (#964) * Adjust nav-link border radius when focused (#961) * Transition between animation states on TextLogo (#955) * Transition between animation states on TextLogo * Remove unused refs * Fixes from review * Disable tabbing to pagination arrows when disabled (#972) * Make position of the "no results" text on grid/gallery views consistent (fixes #963) (#965) * Fix position of the "no results" text on grid view * fix padding * Remove extra margin on main page, fixes #957 (#959) * Fix layout shift and placeholder line height (#973) * Fix a lot of issues * Fix more nuxt 3 issues * fix not all versions showing up (temp) * inline inter css file * More nuxt 3 fixes * [skip ci] broken- backup changes * Change modpack warnings to blue instead of red (#991) * Fix some hydration issues * Update nuxt * Fix some images not showing * Add pagination to versions page + fix lag * Make changelog page consistent with versions page * sync before merge * Delete old file * Fix actions failing * update branch * Fixes navbar transition animation. (#1012) * Fixes navbar transition animation. * Fixes Y-axis animation. Fixes mobile menu. Removes highlightjs prop. * Changes xss call to renderString. * Fixes renderString call. * Removes unnecessary styling. * Reverts mobile nav change. * Nuxt 3 Lazy Loading Search (#1022) * Uses lazyFetch for results. onSearchChange refreshes. Adds loading circle. * Removes console.log * Preserves old page when paging. * Diagnosing filtering bugs. * Fix single facet filtering * Implements useAuth in settings/account. * tiny ssr fix * Updating nuxt.config checklist. * Implements useAuth in revenue, moneitzation, and dashboard index pages. * Fixes setups. * Eliminates results when path changes. Adds animated logo. * Ensures loading animation renders on search page. --------- Co-authored-by: Jai A <jaiagr+gpg@pm.me> * Fix navigation issues * Square button fix (#1023) * Removes checklist from nuxt.config. * Modifies Nuxt CI to build after linting. * Fixes prettierignore file. * bug fixes * Update whitelist domains * Page improvements, fix CLS * Fix a lot of things * Fix project type redirect * Fix 404 errors * Fix user settings + hydration error * Final fixes * fix(creator-section): border radius on icons not aligning with bg (#1027) Co-authored-by: MagnusHJensen <magnus.holm.jensen@lego.dk> * Improvements to the mobile navbar (#984) * Transition between animation states on TextLogo * Remove unused refs * Fixes from review * Improvements to the mobile nav menu * fix avatar alt text * Nevermind, got confused for a moment * Tab bar, menu layout improvements * Highlight search icon when menu is open * Update layouts/default.vue Co-authored-by: Magnus Jensen <magnushjensen.mail@gmail.com> * Fix some issues * Use caret instead * Run prettier * Add create a project --------- Co-authored-by: Magnus Jensen <magnushjensen.mail@gmail.com> Co-authored-by: Geometrically <18202329+Geometrically@users.noreply.github.com> Co-authored-by: Jai A <jaiagr+gpg@pm.me> * Fix mobile menu issues * More issues * Fix lint --------- Co-authored-by: Kaeden Murphy <kmurphy@kaedenmurphy.dev> Co-authored-by: triphora <emmaffle@modrinth.com> Co-authored-by: Zach Baird <30800863+ZachBaird@users.noreply.github.com> Co-authored-by: stairman06 <36215135+stairman06@users.noreply.github.com> Co-authored-by: Zachary Baird <zdb1994@yahoo.com> Co-authored-by: Magnus Jensen <magnushjensen.mail@gmail.com> Co-authored-by: MagnusHJensen <magnus.holm.jensen@lego.dk>
167 lines
3.4 KiB
Vue
167 lines
3.4 KiB
Vue
<template>
|
|
<nav class="navigation">
|
|
<NuxtLink
|
|
v-for="(link, index) in filteredLinks"
|
|
v-show="link.shown === undefined ? true : link.shown"
|
|
:key="index"
|
|
ref="linkElements"
|
|
:to="query ? (link.href ? `?${query}=${link.href}` : '?') : link.href"
|
|
class="nav-link button-animation"
|
|
>
|
|
<span>{{ link.label }}</span>
|
|
</NuxtLink>
|
|
<div
|
|
class="nav-indicator"
|
|
:style="{
|
|
left: positionToMoveX,
|
|
top: positionToMoveY,
|
|
width: sliderWidth,
|
|
opacity: activeIndex === -1 ? 0 : 1,
|
|
}"
|
|
aria-hidden="true"
|
|
></div>
|
|
</nav>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
props: {
|
|
links: {
|
|
default: () => [],
|
|
type: Array,
|
|
},
|
|
query: {
|
|
default: null,
|
|
type: String,
|
|
},
|
|
},
|
|
data() {
|
|
return {
|
|
sliderPositionX: 0,
|
|
sliderPositionY: 18,
|
|
selectedElementWidth: 0,
|
|
activeIndex: -1,
|
|
oldIndex: -1,
|
|
}
|
|
},
|
|
computed: {
|
|
filteredLinks() {
|
|
return this.links.filter((x) => (x.shown === undefined ? true : x.shown))
|
|
},
|
|
positionToMoveX() {
|
|
return `${this.sliderPositionX}px`
|
|
},
|
|
positionToMoveY() {
|
|
return `${this.sliderPositionY}px`
|
|
},
|
|
sliderWidth() {
|
|
return `${this.selectedElementWidth}px`
|
|
},
|
|
},
|
|
watch: {
|
|
'$route.path': {
|
|
handler() {
|
|
this.pickLink()
|
|
},
|
|
},
|
|
'$route.query': {
|
|
handler() {
|
|
if (this.query) this.pickLink()
|
|
},
|
|
},
|
|
},
|
|
mounted() {
|
|
window.addEventListener('resize', this.pickLink)
|
|
this.pickLink()
|
|
},
|
|
unmounted() {
|
|
window.removeEventListener('resize', this.pickLink)
|
|
},
|
|
methods: {
|
|
pickLink() {
|
|
this.activeIndex = this.query
|
|
? this.filteredLinks.findIndex(
|
|
(x) => (x.href === '' ? undefined : x.href) === this.$route.path[this.query]
|
|
)
|
|
: this.filteredLinks.findIndex((x) => x.href === decodeURIComponent(this.$route.path))
|
|
|
|
if (this.activeIndex !== -1) {
|
|
this.startAnimation()
|
|
} else {
|
|
this.oldIndex = -1
|
|
this.sliderPositionX = 0
|
|
this.selectedElementWidth = 0
|
|
}
|
|
},
|
|
startAnimation() {
|
|
const el = this.$refs.linkElements[this.activeIndex].$el
|
|
|
|
this.sliderPositionX = el.offsetLeft
|
|
this.sliderPositionY = el.offsetTop + el.offsetHeight
|
|
this.selectedElementWidth = el.offsetWidth
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.navigation {
|
|
display: flex;
|
|
flex-direction: row;
|
|
align-items: center;
|
|
grid-gap: 1rem;
|
|
flex-wrap: wrap;
|
|
position: relative;
|
|
|
|
.nav-link {
|
|
text-transform: capitalize;
|
|
font-weight: var(--font-weight-bold);
|
|
color: var(--color-text);
|
|
position: relative;
|
|
|
|
&:hover {
|
|
color: var(--color-text);
|
|
|
|
&::after {
|
|
opacity: 0.4;
|
|
}
|
|
}
|
|
|
|
&:active::after {
|
|
opacity: 0.2;
|
|
}
|
|
|
|
&.router-link-exact-active {
|
|
color: var(--color-text);
|
|
|
|
&::after {
|
|
opacity: 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
&.use-animation {
|
|
.nav-link {
|
|
&.is-active::after {
|
|
opacity: 0;
|
|
}
|
|
}
|
|
}
|
|
|
|
.nav-indicator {
|
|
position: absolute;
|
|
height: 0.25rem;
|
|
bottom: -5px;
|
|
left: 0;
|
|
width: 3rem;
|
|
transition: all ease-in-out 0.2s;
|
|
border-radius: var(--size-rounded-max);
|
|
background-color: var(--color-brand);
|
|
|
|
@media (prefers-reduced-motion) {
|
|
transition: none !important;
|
|
}
|
|
}
|
|
}
|
|
</style>
|