Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Improve image grid (#2891)

Olga Bulatfb032c6b36f0
diff --git a/frontend/src/components/VImageCell/VImageCell.vue b/frontend/src/components/VImageCell/VImageCell.vue
index fab2eea00..b041940ab 100644
--- a/frontend/src/components/VImageCell/VImageCell.vue
+++ b/frontend/src/components/VImageCell/VImageCell.vue
@@ -1,10 +1,14 @@
<template>
- <li :style="styles.container">
+ <li
+ :style="styles"
+ class="container w-full max-w-full"
+ :class="isSquare ? 'square' : 'intrinsic'"
+ >
<VLink
itemprop="contentUrl"
:title="contextSensitiveTitle"
:href="imageLink"
- class="group relative block w-full overflow-hidden rounded-sm bg-dark-charcoal-10 text-dark-charcoal-10 focus-bold-filled"
+ class="group relative block w-full overflow-hidden rounded-sm text-dark-charcoal-10 focus-visible:outline-3 focus-visible:outline-offset-4"
:aria-label="contextSensitiveTitle"
@mousedown="sendSelectSearchResultEvent"
>
@@ -12,22 +16,18 @@
itemprop="image"
itemscope
itemtype="https://schema.org/ImageObject"
- class="absolute w-full rounded-sm"
- :class="{ 'relative aspect-square': isSquare }"
- :style="styles.figure"
+ class="grid w-full rounded-sm"
+ :class="{ 'aspect-square': isSquare }"
>
<img
- ref="img"
loading="lazy"
- class="block w-full rounded-sm object-cover duration-200 motion-safe:transition-[filter,transform]"
+ class="image col-span-full row-span-full block w-full overflow-hidden rounded-sm object-cover duration-200 motion-safe:transition-[filter,transform]"
:class="[
isSquare ? 'h-full' : 'margin-auto',
{ 'scale-150 blur-image': shouldBlur },
]"
:alt="
- shouldBlur
- ? $t('sensitiveContent.title.image').toString()
- : image.title
+ shouldBlur ? `${$t('sensitiveContent.title.image')}` : image.title
"
:src="imageUrl"
:width="imgWidth"
@@ -37,19 +37,25 @@
@error="onImageLoadError($event)"
/>
<figcaption
- class="invisible absolute bottom-2 left-2 rounded-sm bg-white p-2 text-dark-charcoal group-hover:visible group-focus:visible"
+ class="col-span-full self-end justify-self-start rounded-sm bg-white text-dark-charcoal group-hover:visible group-focus-visible:visible"
+ :class="
+ isSquare
+ ? 'invisible row-span-full m-2 p-2'
+ : 'my-2 sm:invisible sm:row-span-full sm:m-2 sm:p-2'
+ "
>
<h2 class="sr-only">
{{
- shouldBlur
- ? $t("sensitiveContent.title.image").toString()
- : image.title
+ shouldBlur ? `${$t("sensitiveContent.title.image")}` : image.title
}}
</h2>
- <VLicense :license="image.license" :hide-name="true" />
+ <VLicense
+ :license="image.license"
+ :hide-name="true"
+ class="text-dark-charcoal-70 group-hover:text-dark-charcoal group-focus-visible:text-dark-charcoal sm:text-dark-charcoal"
+ />
</figcaption>
</figure>
- <i v-if="!isSquare" :style="styles.iPadding" class="block" aria-hidden />
</VLink>
</li>
</template>
@@ -116,6 +122,7 @@ export default defineComponent({
const imageUrl = computed(() => {
// TODO: check if we have blurry panorama thumbnails
+ // Use the main image file and not the thumbnails for panorama images to
// fix for blurry panorama thumbnails, introduced in
// https://github.com/cc-archive/cccatalog-frontend/commit/4c9bdac5
if (isPanorama.value) {
@@ -199,3 +206,15 @@ export default defineComponent({
},
})
</script>
+
+<style scoped>
+@screen sm {
+ .intrinsic.container {
+ flex-grow: var(--container-grow);
+ width: var(--container-width);
+ }
+ .intrinsic .image {
+ aspect-ratio: var(--img-aspect-ratio);
+ }
+}
+</style>
diff --git a/frontend/src/components/VImageCell/meta/VImageCell.stories.mdx b/frontend/src/components/VImageCell/meta/VImageCell.stories.mdx
index f47b4c278..cbecc80d0 100644
--- a/frontend/src/components/VImageCell/meta/VImageCell.stories.mdx
+++ b/frontend/src/components/VImageCell/meta/VImageCell.stories.mdx
@@ -17,7 +17,7 @@ export const Template = (args, { argTypes }) => ({
template: `
<ol class="flex flex-wrap gap-4">
<VImageCell
- :image="{ ...image, url: base64Image }"
+ :image="image"
searchTerm="test"
:aspect-ratio="aspectRatio"
relatedTo="fake-uuid"
@@ -38,10 +38,6 @@ export const Template = (args, { argTypes }) => ({
parameters={{
viewport: { defaultViewport: "sm" },
}}
- args={{
- aspectRatio: "intrinsic",
- image: image,
- }}
argTypes={{
aspectRatio: {
options: ["square", "intrinsic"],
@@ -51,6 +47,10 @@ export const Template = (args, { argTypes }) => ({
control: { type: "object" },
},
}}
+ args={{
+ aspectRatio: "intrinsic",
+ image: { ...image, url: base64Image },
+ }}
>
{Template.bind({})}
</Story>
diff --git a/frontend/src/components/VSearchResultsGrid/VImageGrid.vue b/frontend/src/components/VSearchResultsGrid/VImageGrid.vue
index e16237102..4d24a918a 100644
--- a/frontend/src/components/VSearchResultsGrid/VImageGrid.vue
+++ b/frontend/src/components/VSearchResultsGrid/VImageGrid.vue
@@ -1,5 +1,5 @@
<template>
- <section>
+ <section class="pt-2 sm:pt-0">
<VGridSkeleton
v-if="images && !images.length && !fetchState.isFinished"
is-for-tab="image"
diff --git a/frontend/src/composables/use-image-cell-size.ts b/frontend/src/composables/use-image-cell-size.ts
index d5ead64f6..2e16a4c78 100644
--- a/frontend/src/composables/use-image-cell-size.ts
+++ b/frontend/src/composables/use-image-cell-size.ts
@@ -5,12 +5,12 @@ import type { ImageDimensions } from "~/types/media"
const minAspect = 3 / 4
const maxAspect = 16 / 9
const panoramaAspect = 21 / 9
-const minRowWidth = 450
+const minRowWidth = 250
const widthBasis = minRowWidth / maxAspect
const squareSize = 250
const defaultImgSize = 100
-const getContainerAspect = (aspect: number) => {
+const getImgAspectRatio = (aspect: number) => {
if (aspect > maxAspect) return maxAspect
if (aspect < minAspect) return minAspect
return aspect
@@ -30,46 +30,30 @@ export const useImageCellSize = ({
isSquare.value ? squareSize : imageSize.width || defaultImgSize
)
- const imageAspect = computed(() => imgWidth.value / imgHeight.value)
- const isPanorama = computed(() => imageAspect.value > panoramaAspect)
+ const naturalAspectRatio = computed(() => imgWidth.value / imgHeight.value)
+ const isPanorama = computed(() => naturalAspectRatio.value > panoramaAspect)
/**
- * Returns the style declarations for container, figure and i padding.
+ * Returns the style declarations for the container width, aspect ratio and flex-grow value.
* For the square cell, the styles are empty.
*/
const styles = computed(() => {
- const aspect = imageAspect.value
-
- if (isSquare.value)
- return {
- container: "",
- figure: "",
- iPadding: "",
- }
-
- const containerAspect = getContainerAspect(aspect)
- const containerWidth = containerAspect * widthBasis
-
- let imageWidth, imageLeft, imageTop
-
- if (aspect < maxAspect) {
- imageWidth = 100
- imageLeft = 0
- } else {
- imageWidth = (aspect / maxAspect) * 100
- imageLeft = ((aspect - maxAspect) / maxAspect) * -50
+ const styles = {}
+ if (isSquare.value) {
+ return styles
}
- if (aspect > minAspect) {
- imageTop = 0
- } else {
- imageTop = ((minAspect - aspect) / (aspect * minAspect * minAspect)) * -50
- }
+ const aspect = naturalAspectRatio.value
+ /**
+ * The aspect-ratio for `img` is clamped between the min and max aspect ratios.
+ */
+ const imgAspectRatio = getImgAspectRatio(aspect)
+ const containerWidth = Math.round(imgAspectRatio * widthBasis)
return {
- container: `width: ${containerWidth}px;flex-grow: ${containerWidth}`,
- figure: `width: ${imageWidth}%; top: ${imageTop}%; left:${imageLeft}%;`,
- iPadding: `padding-bottom:${(1 / containerAspect) * 100}%`,
+ "--container-width": `${containerWidth}px`,
+ "--container-grow": containerWidth,
+ "--img-aspect-ratio": imgAspectRatio,
}
})
diff --git a/frontend/tailwind.config.ts b/frontend/tailwind.config.ts
index 227f34cfb..222b09af7 100644
--- a/frontend/tailwind.config.ts
+++ b/frontend/tailwind.config.ts
@@ -229,6 +229,7 @@ export default {
},
outlineWidth: {
1.5: "1.5px",
+ 3: "3px",
},
typography: (theme: PluginAPI["theme"]) => ({
DEFAULT: {
diff --git a/frontend/test/playwright/utils/breakpoints.ts b/frontend/test/playwright/utils/breakpoints.ts
index ac2575511..df9b22d11 100644
--- a/frontend/test/playwright/utils/breakpoints.ts
+++ b/frontend/test/playwright/utils/breakpoints.ts
@@ -155,6 +155,7 @@ const describeEachMobileWithoutMd = describeEachBreakpoint(
mobileBreakpoints.filter((b) => b !== "md")
)
const describeMobileAndDesktop = describeEachBreakpoint(["sm", "xl"])
+const describeMobileXsAndDesktop = describeEachBreakpoint(["xs", "xl"])
export default {
...breakpointTests,
@@ -168,4 +169,6 @@ export default {
// For testing functionality in e2e tests, we need to test mobile and desktop screens.
// Having two breakpoints should be enough and should save testing time.
describeMobileAndDesktop,
+ // All tests
+ describeMobileXsAndDesktop,
}
diff --git a/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-ltr-from-search-results-2xl-linux.png b/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-ltr-from-search-results-2xl-linux.png
index 100865bc8..cbb6d36f4 100644
Binary files a/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-ltr-from-search-results-2xl-linux.png and b/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-ltr-from-search-results-2xl-linux.png differ
diff --git a/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-ltr-from-search-results-lg-linux.png b/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-ltr-from-search-results-lg-linux.png
index b9bfdc020..d9f9c88a8 100644
Binary files a/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-ltr-from-search-results-lg-linux.png and b/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-ltr-from-search-results-lg-linux.png differ
diff --git a/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-ltr-from-search-results-md-linux.png b/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-ltr-from-search-results-md-linux.png
index 964a84e95..812314cd4 100644
Binary files a/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-ltr-from-search-results-md-linux.png and b/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-ltr-from-search-results-md-linux.png differ
diff --git a/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-ltr-from-search-results-sm-linux.png b/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-ltr-from-search-results-sm-linux.png
index 2901f982b..70aec2034 100644
Binary files a/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-ltr-from-search-results-sm-linux.png and b/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-ltr-from-search-results-sm-linux.png differ
diff --git a/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-ltr-from-search-results-xl-linux.png b/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-ltr-from-search-results-xl-linux.png
index 3dc48e538..b07ae68ce 100644
Binary files a/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-ltr-from-search-results-xl-linux.png and b/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-ltr-from-search-results-xl-linux.png differ
diff --git a/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-ltr-from-search-results-xs-linux.png b/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-ltr-from-search-results-xs-linux.png
index 52a12de7d..64672a4dd 100644
Binary files a/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-ltr-from-search-results-xs-linux.png and b/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-ltr-from-search-results-xs-linux.png differ
diff --git a/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-rtl-from-search-results-2xl-linux.png b/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-rtl-from-search-results-2xl-linux.png
index 820762883..cf731feff 100644
Binary files a/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-rtl-from-search-results-2xl-linux.png and b/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-rtl-from-search-results-2xl-linux.png differ
diff --git a/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-rtl-from-search-results-lg-linux.png b/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-rtl-from-search-results-lg-linux.png
index 00c90dc25..9e936e6de 100644
Binary files a/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-rtl-from-search-results-lg-linux.png and b/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-rtl-from-search-results-lg-linux.png differ
diff --git a/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-rtl-from-search-results-md-linux.png b/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-rtl-from-search-results-md-linux.png
index 72d249ad2..49d4578a1 100644
Binary files a/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-rtl-from-search-results-md-linux.png and b/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-rtl-from-search-results-md-linux.png differ
diff --git a/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-rtl-from-search-results-sm-linux.png b/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-rtl-from-search-results-sm-linux.png
index cf9816534..800c778a8 100644
Binary files a/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-rtl-from-search-results-sm-linux.png and b/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-rtl-from-search-results-sm-linux.png differ
diff --git a/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-rtl-from-search-results-xl-linux.png b/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-rtl-from-search-results-xl-linux.png
index 131b945f7..09eea17e1 100644
Binary files a/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-rtl-from-search-results-xl-linux.png and b/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-rtl-from-search-results-xl-linux.png differ
diff --git a/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-rtl-from-search-results-xs-linux.png b/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-rtl-from-search-results-xs-linux.png
index 63198f9a6..4996b89e1 100644
Binary files a/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-rtl-from-search-results-xs-linux.png and b/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/image-rtl-from-search-results-xs-linux.png differ
diff --git a/frontend/test/storybook/visual-regression/v-image-cell.spec.ts b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts
index 6f29b1e19..abf16c868 100644
--- a/frontend/test/storybook/visual-regression/v-image-cell.spec.ts
+++ b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts
@@ -2,6 +2,8 @@ import { expect, test } from "@playwright/test"
import { makeGotoWithArgs } from "~~/test/storybook/utils/args"
+import breakpoints from "~~/test/playwright/utils/breakpoints"
+
import type { AspectRatio } from "~/types/media"
const imageCell = "a[itemprop='contentUrl']"
@@ -11,45 +13,51 @@ const screenshotEl = ".sb-main-padded"
test.describe.configure({ mode: "parallel" })
-test.describe("VImageCell", () => {
- const gotoWithArgs = makeGotoWithArgs("components-vimagecell--v-image-cell")
- const aspectRatios: AspectRatio[] = ["square", "intrinsic"]
-
- for (const ratio of aspectRatios) {
- test(`${ratio} loaded`, async ({ page }) => {
- await gotoWithArgs(page, { aspectRatio: ratio })
- const mainEl = page.locator(imageCell)
- await expect(mainEl).toBeVisible()
- expect(await page.locator(screenshotEl).screenshot()).toMatchSnapshot({
- name: `v-image-cell-${ratio}-loaded.png`,
+breakpoints.describeMobileXsAndDesktop(({ expectSnapshot }) => {
+ test.describe("VImageCell", () => {
+ const gotoWithArgs = makeGotoWithArgs("components-vimagecell--v-image-cell")
+ const aspectRatios: AspectRatio[] = ["square", "intrinsic"]
+
+ for (const ratio of aspectRatios) {
+ test(`${ratio} loaded`, async ({ page }) => {
+ await gotoWithArgs(page, { aspectRatio: ratio })
+ const mainEl = page.locator(imageCell)
+ await expect(mainEl).toBeVisible()
+ await expectSnapshot(
+ `v-image-cell-${ratio}-loaded`,
+ page.locator(screenshotEl)
+ )
})
- })
-
- test(`${ratio} focused`, async ({ page }) => {
- await gotoWithArgs(page, { aspectRatio: ratio })
- await page.focus(imageCell)
- await page.locator(imageCell).click()
- expect(await page.locator(screenshotEl).screenshot()).toMatchSnapshot({
- name: `v-image-cell-${ratio}-focused.png`,
+
+ test(`${ratio} focused`, async ({ page }) => {
+ await gotoWithArgs(page, { aspectRatio: ratio })
+ await page.focus(imageCell)
+ await page.locator(imageCell).click()
+ await expectSnapshot(
+ `v-image-cell-${ratio}-focused`,
+ page.locator(screenshotEl)
+ )
})
- })
- test(`${ratio} hovered`, async ({ page }) => {
- await gotoWithArgs(page, { aspectRatio: ratio })
- await page.hover(imageCell)
- expect(await page.locator(screenshotEl).screenshot()).toMatchSnapshot({
- name: `v-image-cell-${ratio}-hovered.png`,
+ test(`${ratio} hovered`, async ({ page }) => {
+ await gotoWithArgs(page, { aspectRatio: ratio })
+ await page.hover(imageCell)
+ await expectSnapshot(
+ `v-image-cell-${ratio}-hovered`,
+ page.locator(screenshotEl)
+ )
})
- })
-
- test(`${ratio} focused hovered`, async ({ page }) => {
- await gotoWithArgs(page, { aspectRatio: ratio })
- await page.focus(imageCell)
- await page.hover(imageCell)
- await page.locator(imageCell).click()
- expect(await page.locator(screenshotEl).screenshot()).toMatchSnapshot({
- name: `v-image-cell-${ratio}-focused-hovered.png`,
+
+ test(`${ratio} focused hovered`, async ({ page }) => {
+ await gotoWithArgs(page, { aspectRatio: ratio })
+ await page.focus(imageCell)
+ await page.hover(imageCell)
+ await page.locator(imageCell).click()
+ await expectSnapshot(
+ `v-image-cell-${ratio}-focused-hovered`,
+ page.locator(screenshotEl)
+ )
})
- })
- }
+ }
+ })
})
diff --git a/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-intrinsic-focused-hovered-linux.png b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-intrinsic-focused-hovered-linux.png
deleted file mode 100644
index 4a21e4557..000000000
Binary files a/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-intrinsic-focused-hovered-linux.png and /dev/null differ
diff --git a/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-intrinsic-focused-hovered-xl-linux.png b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-intrinsic-focused-hovered-xl-linux.png
new file mode 100644
index 000000000..5bd7d73ad
Binary files /dev/null and b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-intrinsic-focused-hovered-xl-linux.png differ
diff --git a/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-intrinsic-focused-hovered-xs-linux.png b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-intrinsic-focused-hovered-xs-linux.png
new file mode 100644
index 000000000..1e7d268d4
Binary files /dev/null and b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-intrinsic-focused-hovered-xs-linux.png differ
diff --git a/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-intrinsic-focused-linux.png b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-intrinsic-focused-linux.png
deleted file mode 100644
index 4a21e4557..000000000
Binary files a/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-intrinsic-focused-linux.png and /dev/null differ
diff --git a/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-intrinsic-focused-xl-linux.png b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-intrinsic-focused-xl-linux.png
new file mode 100644
index 000000000..5bd7d73ad
Binary files /dev/null and b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-intrinsic-focused-xl-linux.png differ
diff --git a/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-intrinsic-focused-xs-linux.png b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-intrinsic-focused-xs-linux.png
new file mode 100644
index 000000000..1e7d268d4
Binary files /dev/null and b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-intrinsic-focused-xs-linux.png differ
diff --git a/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-intrinsic-hovered-linux.png b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-intrinsic-hovered-xl-linux.png
similarity index 100%
rename from frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-intrinsic-hovered-linux.png
rename to frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-intrinsic-hovered-xl-linux.png
diff --git a/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-intrinsic-hovered-xs-linux.png b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-intrinsic-hovered-xs-linux.png
new file mode 100644
index 000000000..778a40063
Binary files /dev/null and b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-intrinsic-hovered-xs-linux.png differ
diff --git a/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-intrinsic-loaded-linux.png b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-intrinsic-loaded-xl-linux.png
similarity index 100%
rename from frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-intrinsic-loaded-linux.png
rename to frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-intrinsic-loaded-xl-linux.png
diff --git a/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-intrinsic-loaded-xs-linux.png b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-intrinsic-loaded-xs-linux.png
new file mode 100644
index 000000000..4dd1bc6cf
Binary files /dev/null and b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-intrinsic-loaded-xs-linux.png differ
diff --git a/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-focused-hovered-linux.png b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-focused-hovered-linux.png
deleted file mode 100644
index 30b261001..000000000
Binary files a/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-focused-hovered-linux.png and /dev/null differ
diff --git a/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-focused-hovered-xl-linux.png b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-focused-hovered-xl-linux.png
new file mode 100644
index 000000000..140cf6105
Binary files /dev/null and b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-focused-hovered-xl-linux.png differ
diff --git a/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-focused-hovered-xs-linux.png b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-focused-hovered-xs-linux.png
new file mode 100644
index 000000000..957c85aae
Binary files /dev/null and b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-focused-hovered-xs-linux.png differ
diff --git a/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-focused-linux.png b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-focused-linux.png
deleted file mode 100644
index 30b261001..000000000
Binary files a/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-focused-linux.png and /dev/null differ
diff --git a/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-focused-xl-linux.png b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-focused-xl-linux.png
new file mode 100644
index 000000000..140cf6105
Binary files /dev/null and b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-focused-xl-linux.png differ
diff --git a/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-focused-xs-linux.png b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-focused-xs-linux.png
new file mode 100644
index 000000000..957c85aae
Binary files /dev/null and b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-focused-xs-linux.png differ
diff --git a/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-hovered-linux.png b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-hovered-linux.png
deleted file mode 100644
index 5485a3ea8..000000000
Binary files a/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-hovered-linux.png and /dev/null differ
diff --git a/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-hovered-xl-linux.png b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-hovered-xl-linux.png
new file mode 100644
index 000000000..af5da0b73
Binary files /dev/null and b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-hovered-xl-linux.png differ
diff --git a/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-hovered-xs-linux.png b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-hovered-xs-linux.png
new file mode 100644
index 000000000..c2d3aed27
Binary files /dev/null and b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-hovered-xs-linux.png differ
diff --git a/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-loaded-linux.png b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-loaded-linux.png
deleted file mode 100644
index 22ac8df25..000000000
Binary files a/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-loaded-linux.png and /dev/null differ
diff --git a/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-loaded-xl-linux.png b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-loaded-xl-linux.png
new file mode 100644
index 000000000..7aad81c57
Binary files /dev/null and b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-loaded-xl-linux.png differ
diff --git a/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-loaded-xs-linux.png b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-loaded-xs-linux.png
new file mode 100644
index 000000000..b9c8c0f54
Binary files /dev/null and b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts-snapshots/v-image-cell-square-loaded-xs-linux.png differ
diff --git a/frontend/test/unit/specs/composables/use-image-cell-size.spec.js b/frontend/test/unit/specs/composables/use-image-cell-size.spec.js
index 636bcd60f..a4965fb1a 100644
--- a/frontend/test/unit/specs/composables/use-image-cell-size.spec.js
+++ b/frontend/test/unit/specs/composables/use-image-cell-size.spec.js
@@ -12,7 +12,7 @@ describe("useImageCellSize", () => {
expect(imgHeight.value).toEqual(250)
expect(imgWidth.value).toEqual(250)
expect(isPanorama.value).toEqual(false)
- expect(styles.value).toEqual({ container: "", figure: "", iPadding: "" })
+ expect(styles.value).toEqual({})
})
it("Should return correct values for intrinsic panorama image", () => {
@@ -27,9 +27,9 @@ describe("useImageCellSize", () => {
expect(imgWidth.value).toEqual(WIDTH)
expect(isPanorama.value).toEqual(true)
expect(styles.value).toEqual({
- container: "width: 450px;flex-grow: 450",
- figure: "width: 675%; top: 0%; left:-287.5%;",
- iPadding: "padding-bottom:56.25%",
+ "--container-grow": 250,
+ "--container-width": "250px",
+ "--img-aspect-ratio": 1.7777777777777777,
})
})
@@ -45,9 +45,9 @@ describe("useImageCellSize", () => {
expect(imgWidth.value).toEqual(WIDTH)
expect(isPanorama.value).toEqual(false)
expect(styles.value).toEqual({
- container: "width: 189.84375px;flex-grow: 189.84375",
- figure: "width: 100%; top: -711.1111111111111%; left:0%;",
- iPadding: "padding-bottom:133.33333333333331%",
+ "--container-grow": 105,
+ "--container-width": "105px",
+ "--img-aspect-ratio": 0.75,
})
})
@@ -63,9 +63,9 @@ describe("useImageCellSize", () => {
expect(imgWidth.value).toEqual(WIDTH)
expect(isPanorama.value).toEqual(false)
expect(styles.value).toEqual({
- container: "width: 253.125px;flex-grow: 253.125",
- figure: "width: 100%; top: 0%; left:0%;",
- iPadding: "padding-bottom:100%",
+ "--container-grow": 141,
+ "--container-width": "141px",
+ "--img-aspect-ratio": 1,
})
})
})