feat: AcfImage component based on @nuxt/image
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
fragment AcfImage on MediaItem {
|
||||
src: sourceUrl
|
||||
alt: altText
|
||||
mediaDetails {
|
||||
width
|
||||
height
|
||||
}
|
||||
objectPosition
|
||||
}
|
||||
18
wp-content/themes/moonshine/app/components/acf/AcfImage.vue
Normal file
18
wp-content/themes/moonshine/app/components/acf/AcfImage.vue
Normal file
@@ -0,0 +1,18 @@
|
||||
<script setup lang="ts">
|
||||
import type { AcfImageFragment } from "#graphql/operations";
|
||||
|
||||
defineProps<{ image?: AcfImageFragment }>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NuxtImg
|
||||
v-if="image"
|
||||
:src="image.src"
|
||||
:alt="image.alt"
|
||||
:width="image.mediaDetails?.width"
|
||||
:height="image.mediaDetails?.height"
|
||||
:style="{ objectPosition: image.objectPosition || 'center' }"
|
||||
format="avif,webp"
|
||||
placeholder
|
||||
/>
|
||||
</template>
|
||||
Reference in New Issue
Block a user