Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nuxt example frontend lighthouse fixes #165

Merged
merged 9 commits into from
Nov 28, 2024
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,8 @@ example-nextjs-admin: ## Starts Volto, allowing reloading of the add-on during d
## Examples
.PHONY: example-nextjs-frontend
example-nextjs-frontend: ## Starts nextjs example frontend
pnpm example:nextjs
pnpm example:nextjs

.PHONY: example-nuxt-frontend
example-nuxt-frontend: ## Starts nuxt example frontend
pnpm example:nuxt
15 changes: 8 additions & 7 deletions examples/nuxt-blog-starter/components/block.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,16 @@
<div
class="max-w-sm p-6 bg-slate-200/90 border border-gray-200 m-12 rounded-lg shadow dark:bg-gray-800 dark:border-gray-700 absolute"
:class="{ 'right-0': block.flagAlign == 'right' }">
<NuxtLink :to="getUrl(block.href[0])">
<div>{{ block.head_title }}</div>
<h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white"
data-editable-field="title">{{ block.title }}</h5>
</NuxtLink>
<div>{{ block.head_title }}</div>
<h5 :id="`heading-${block['@id']}`"
class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white" data-editable-field="title">
{{ block.title }}</h5>
<p class="mb-3 font-normal text-gray-700 dark:text-gray-400" data-editable-field="description">
{{ block.description }}</p>
<NuxtLink v-if="block.href" :to="getUrl(block.href[0])" data-editable-field="buttonText"
class="inline-flex items-center px-3 py-2 text-sm font-medium text-center text-white bg-blue-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">
<NuxtLink v-if="block.href" :to="getUrl(block.href[0])" data-editable-field="buttonText"
class="inline-flex items-center px-3 py-2 text-sm font-medium text-center text-white bg-blue-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"
:aria-describedby="`heading-${block['@id']}`">

{{ block.buttonText || 'Read More' }}</NuxtLink>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions examples/nuxt-blog-starter/components/header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
<li v-if="!item.items.length">
<NuxtLink :to="getUrl(item)" class="block py-2 px-3 text-blue-600 border-b border-gray-100 hover:bg-gray-50 md:hover:bg-transparent md:border-0 md:hover:text-blue-600 md:p-0 dark:text-blue-500 md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-blue-500 md:dark:hover:bg-transparent dark:border-gray-700" aria-current="page">{{ item.title }}</NuxtLink>
</li>
<li v-else>
<button id="mega-menu-dropdown-button" :data-dropdown-toggle="getId(item)" class="flex items-center z-30 justify-between w-full py-2 px-3 font-medium text-gray-900 border-b border-gray-100 md:w-auto hover:bg-gray-50 md:hover:bg-transparent md:border-0 md:hover:text-blue-600 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-blue-500 md:dark:hover:bg-transparent dark:border-gray-700">
<li v-else >
<button :id="`mega-menu-dropdown-button-${getId(item)}`" :data-dropdown-toggle="getId(item)" class="flex items-center z-30 justify-between w-full py-2 px-3 font-medium text-gray-900 border-b border-gray-100 md:w-auto hover:bg-gray-50 md:hover:bg-transparent md:border-0 md:hover:text-blue-600 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-blue-500 md:dark:hover:bg-transparent dark:border-gray-700">
{{item.title}} <svg class="w-2.5 h-2.5 ms-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 10 6">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 4 4 4-4"/>
</svg>
</button>
<div :id="getId(item)" class="absolute z-40 grid hidden w-auto grid-cols-2 text-sm bg-white border border-gray-100 rounded-lg shadow-md dark:border-gray-700 md:grid-cols-3 dark:bg-gray-700">
<div v-for="(chunk) in chunkArray(item.items, 4)" class="p-4 pb-0 text-gray-900 md:pb-4 dark:text-white" aria-labelledby="mega-menu-dropdown-button">
<div v-for="(chunk) in chunkArray(item.items, 4)" class="p-4 pb-0 text-gray-900 md:pb-4 dark:text-white">
<ul class="space-y-4" >
<li v-for="(item) in chunk">
<NuxtLink :to="getUrl(item)" class="text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-500">
Expand Down
7 changes: 7 additions & 0 deletions examples/nuxt-blog-starter/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import mkcert from 'vite-plugin-mkcert'

export default defineNuxtConfig({
app: {
head: {
htmlAttrs: {
lang: 'en',
},
},
},
modules: [
'@nuxtjs/tailwindcss',
'nuxt-security',
Expand Down
Loading