Skip to content

Commit

Permalink
feat: add vue-skip-to plugin (#228)
Browse files Browse the repository at this point in the history
* feat: add vue-skip-to plugin

* feat: add anchor to nuxt page for vue-skip-to

* feat: add footer component in layout
  • Loading branch information
Illawind authored Jan 9, 2025
1 parent 8da0cf3 commit 4e3e799
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 8 deletions.
7 changes: 7 additions & 0 deletions components/organisms/VFooter/VFooter.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!-- <script setup lang="ts"></script> -->

<template>
<footer id="footer" />
</template>

<!-- <style lang="scss" module></style> -->
20 changes: 18 additions & 2 deletions layouts/default.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script setup lang="ts">
import type { RoadizNodesSources } from '@roadiz/types'
import VFooter from '~/components/organisms/VFooter/VFooter.vue'
// init Roadiz page data (i.e. dynamic page)
await callOnce(async () => {
Expand Down Expand Up @@ -32,8 +33,23 @@ await callOnce(async () => {

<template>
<div>
<NuxtPage />
<ClientOnly>
<VueSkipTo
:class="$style['skip-to-nav']"
:list-label="$t('skip_to.list_label').toString()"
:to="[
{ anchor: '#main', label: $t('skip_to.main_content') },
{ anchor: '#footer', label: $t('skip_to.footer') },
]"
/>
</ClientOnly>
<NuxtPage id="main" />
<VFooter />
</div>
</template>

<!-- <style module lang="scss"></style> -->
<style module lang="scss">
.skip-to-nav {
z-index: 10000;
}
</style>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"@sentry/node": "^8.47.0",
"@sentry/vue": "^8.47.0",
"@types/lodash": "^4.17.14",
"@vue-a11y/skip-to": "^2.1.2",
"@vue-a11y/skip-to": "^3.0.3",
"@vueuse/core": "^12.0.0",
"body-scroll-lock": "^3.1.5",
"floating-vue": "^5.2.2",
Expand Down
12 changes: 12 additions & 0 deletions plugins/11.vueSkipTo.client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import VueSkipTo from '@vue-a11y/skip-to'
import '@vue-a11y/skip-to/dist/style.css'

declare module 'vue' {
interface GlobalComponents {
VueSkipTo: ComponentPublicInstance
}
}

export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.use(VueSkipTo)
})
14 changes: 9 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4e3e799

Please sign in to comment.