Skip to content
Snippets Groups Projects
Commit 6320e3ba authored by Konrad Mohrfeldt's avatar Konrad Mohrfeldt :koala:
Browse files

refactor: use new image.url property as source for images

refs #286
parent 8ef4f578
No related branches found
No related tags found
No related merge requests found
......@@ -10,7 +10,7 @@
v-if="image"
:alt="image.altText"
class="tw-object-cover tw-w-full tw-max-w-full tw-max-h-full"
:src="image.image"
:src="image.url"
:sizes="`${containerWidth}px`"
:srcset="srcset"
:class="{
......@@ -32,10 +32,7 @@ const { width: containerWidth } = useElementSize(containerEl)
const srcset = computed(() => {
const image = props.image
if (!image) return ''
let sources = [
{ width: image.width, height: image.height, url: image.image },
...image.thumbnails,
]
let sources = [{ width: image.width, height: image.height, url: image.url }, ...image.thumbnails]
if (props.square) sources = sources.filter((img) => img.width === img.height)
return sources.map(({ width, url }) => `${url} ${width}w`).join(',')
})
......
......@@ -6,7 +6,7 @@
<li v-for="image in imageStore.items" :key="image.id" class="tw-block">
<ImagePreview
as="button"
:url="image.image"
:url="image.url"
:alt="image.altText ?? ''"
class="tw-h-full tw-aspect-square tw-cursor-pointer tw-border tw-border-gray-200 tw-origin-center tw-transition-all tw-ring-blue-200 tw-ring-offset-2 tw-rounded tw-overflow-hidden hover:tw-z-20 hover:tw-ring-4 focus:tw-ring-4 focus:tw-outline-none"
tabindex="0"
......
<template>
<ImagePreview
:url="image.image"
:url="image.url"
class="tw-p-6 tw-bg-gray-700 tw-shadow-inner tw-flex tw-rounded tw-max-h-[300px]"
:cover="false"
/>
......
<template>
<ImagePreview
:url="image?.image ?? null"
:url="image?.url ?? null"
class="tw-inline-flex tw-h-64 tw-max-w-full tw-min-w-[320px] tw-bg-gray-700 tw-rounded tw-flex-1"
v-bind="attrs"
>
......
......@@ -15,7 +15,7 @@
<img
v-if="noteImage"
class="tw-object-cover tw-h-full tw-w-full tw-max-w-full tw-max-h-full"
:src="noteImage.image"
:src="noteImage.url"
sizes="100px"
:srcset="
noteImage.thumbnails
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment