Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Openverse Redesign (#478)
Zack Krida5594e693fee0
diff --git a/README.md b/README.mdindex 083358b9a..b629a6312 100644--- a/README.md+++ b/README.md@@ -1,7 +1,7 @@<img src="https://github.com/WordPress/openverse/raw/main/brand/banner.svg" width="100%"/><p align="center">- <a href="https://github.com/orgs/WordPress/projects/3">Project Board</a> | <a href="https://make.wordpress.org/openverse/">Community Site</a> | <a href="https://make.wordpress.org/chat/">#openverse @ Slack</a> | <a href="https://make.wordpress.org/openverse/handbook/openverse-handbook/">Handbook</a> | <a href="https://www.figma.com/files/project/31962071/Openverse?fuid=979162431688906882">Figma</a>+ <a href="https://github.com/orgs/WordPress/projects/3">Project Board</a> | <a href="https://make.wordpress.org/openverse/">Community Site</a> | <a href="https://make.wordpress.org/chat/">#openverse @ Slack</a> | <a href="https://make.wordpress.org/openverse/handbook/openverse-handbook/">Handbook</a> | <a href="https://www.figma.com/file/w60dl1XPUvSaRncv1Utmnb/Openverse-Releases">Figma Mockups</a> | <a href="https://www.figma.com/file/GIIQ4sDbaToCfFQyKMvzr8/Openverse-Design-Library">Figma Design Library</a></p># Openverse Frontenddiff --git a/package.json b/package.jsonindex fa5457e61..72e3b0f95 100644--- a/package.json+++ b/package.json@@ -65,6 +65,7 @@"lodash.findindex": "^4.6.0","lodash.isempty": "^4.4.0","lodash.sortby": "^4.7.0",+ "lodash.throttle": "^4.1.1","node-html-parser": "^5.1.0","nuxt": "^2.15.4","reakit-utils": "^0.15.2",@@ -79,7 +80,7 @@"@nuxtjs/storybook": "^4.1.1","@nuxtjs/style-resources": "^1.0.0","@playwright/test": "^1.16.2",- "@testing-library/jest-dom": "^5.14.1",+ "@testing-library/jest-dom": "^5.16.1","@testing-library/user-event": "^13.2.1","@testing-library/vue": "^5.8.2","@types/jest": "^26.0.22",@@ -112,7 +113,7 @@},"engines": {"node": ">= 16.0.0",- "pnpm": ">=6.24.0"+ "pnpm": ">= 6.24.0"},"browserslist": ["> 1%",diff --git a/playwright.config.js b/playwright.config.jsindex 502683ce2..d24fe3d9c 100644--- a/playwright.config.js+++ b/playwright.config.js@@ -4,5 +4,6 @@ const config = {use: {baseURL: 'http://localhost:8443',},+ timeout: 1 * 60 * 1000,}module.exports = configdiff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 25fba7bbc..6275e6cfe 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -17,7 +17,7 @@ specifiers:'@nuxtjs/style-resources': ^1.0.0'@nuxtjs/svg': ^0.3.0'@playwright/test': ^1.16.2- '@testing-library/jest-dom': ^5.14.1+ '@testing-library/jest-dom': ^5.16.1'@testing-library/user-event': ^13.2.1'@testing-library/vue': ^5.8.2'@types/jest': ^26.0.22@@ -54,6 +54,7 @@ specifiers:lodash.findindex: ^4.6.0lodash.isempty: ^4.4.0lodash.sortby: ^4.7.0+ lodash.throttle: ^4.1.1node-html-parser: ^5.1.0nuxt: ^2.15.4postcss: ^8.4.5@@ -99,6 +100,7 @@ dependencies:lodash.findindex: 4.6.0lodash.isempty: 4.4.0lodash.sortby: 4.7.0+ lodash.throttle: 4.1.1node-html-parser: 5.1.0nuxt: [email protected]reakit-utils: 0.15.2@@ -137,7 +139,7 @@ devDependencies:sass: 1.45.0sass-loader: [email protected]start-server-and-test: 1.14.0- tailwindcss: 3.0.7_67faf65efc23bbcb8667813493b8c465+ tailwindcss: 3.0.9_67faf65efc23bbcb8667813493b8c465tailwindcss-rtl: 0.8.0ts-node: [email protected]typescript: 4.5.4@@ -12376,6 +12378,10 @@ packages:lodash._reinterpolate: 3.0.0dev: false+ /lodash.throttle/4.1.1:+ resolution: {integrity: sha1-wj6RtxAkKscMN/HhzaknTMOb8vQ=}+ dev: false+/lodash.truncate/4.4.2:resolution: {integrity: sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM=}dev: true@@ -16749,8 +16755,8 @@ packages:resolution: {integrity: sha512-D+iKrobvc29qAmjwh3IpA2ZrBJacg2tSED7m9doJMCqlqneb8/dK71j0An+zCZQ+pI/c+/CBcm/x7nirzPWVOA==}dev: true- /tailwindcss/3.0.7_67faf65efc23bbcb8667813493b8c465:- resolution: {integrity: sha512-rZdKNHtC64jcQncLoWOuCzj4lQDTAgLtgK3WmQS88tTdpHh9OwLqULTQxI3tw9AMJsqSpCKlmcjW/8CSnni6zQ==}+ /tailwindcss/3.0.9_67faf65efc23bbcb8667813493b8c465:+ resolution: {integrity: sha512-X8TVifxDWfiNXInOeBofTteXAtZ5f0HnLs/uV4jDQNShc33Jb7qjYbk4VwI365rWAzcqYTks+9kesf3xH7Y35A==}engines: {node: '>=12.13.0'}hasBin: truepeerDependencies:@@ -16779,7 +16785,6 @@ packages:postcss-value-parser: 4.2.0quick-lru: 5.1.1resolve: 1.20.0- tmp: 0.2.1transitivePeerDependencies:- ts-nodedev: true@@ -17000,13 +17005,6 @@ packages:os-tmpdir: 1.0.2dev: false- /tmp/0.2.1:- resolution: {integrity: sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==}- engines: {node: '>=8.17.0'}- dependencies:- rimraf: 3.0.2- dev: true-/tmpl/1.0.5:resolution: {integrity: sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==}dev: truediff --git a/src/assets/icons/all-content.svg b/src/assets/icons/all-content.svgnew file mode 100644index 000000000..870a250ad--- /dev/null+++ b/src/assets/icons/all-content.svg@@ -0,0 +1,3 @@+<svg fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">+ <path id="icon" clip-rule="evenodd" d="m9 5.5h-3c-.27614 0-.5.22386-.5.5v12c0 .2761.22386.5.5.5h3c.27614 0 .5-.2239.5-.5v-12c0-.27614-.22386-.5-.5-.5zm-3-1.5c-1.10457 0-2 .89543-2 2v12c0 1.1046.89543 2 2 2h3c1.1046 0 2-.8954 2-2v-12c0-1.10457-.8954-2-2-2zm12 1.5h-3c-.2761 0-.5.22386-.5.5v3c0 .27614.2239.5.5.5h3c.2761 0 .5-.22386.5-.5v-3c0-.27614-.2239-.5-.5-.5zm-3-1.5c-1.1046 0-2 .89543-2 2v3c0 1.1046.8954 2 2 2h3c1.1046 0 2-.8954 2-2v-3c0-1.10457-.8954-2-2-2zm0 10.5h3c.2761 0 .5.2239.5.5v3c0 .2761-.2239.5-.5.5h-3c-.2761 0-.5-.2239-.5-.5v-3c0-.2761.2239-.5.5-.5zm-2 .5c0-1.1046.8954-2 2-2h3c1.1046 0 2 .8954 2 2v3c0 1.1046-.8954 2-2 2h-3c-1.1046 0-2-.8954-2-2z" fill="currentColor" fill-rule="evenodd"/>+</svg>diff --git a/src/assets/icons/audio-content.svg b/src/assets/icons/audio-content.svgnew file mode 100644index 000000000..e918a3c1a--- /dev/null+++ b/src/assets/icons/audio-content.svg@@ -0,0 +1,9 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+ <g id="icon">+ <path fill-rule="evenodd" clip-rule="evenodd" d="M3.25 7L3.25 17H4.75V7H3.25Z" fill="currentColor"/>+ <path fill-rule="evenodd" clip-rule="evenodd" d="M19.25 7V17H20.75V7H19.25Z" fill="currentColor"/>+ <path fill-rule="evenodd" clip-rule="evenodd" d="M7.25 4L7.25 20H8.75V4H7.25Z" fill="currentColor"/>+ <path fill-rule="evenodd" clip-rule="evenodd" d="M12.75 7L12.75 17L11.25 17L11.25 7L12.75 7Z" fill="currentColor"/>+ <path fill-rule="evenodd" clip-rule="evenodd" d="M15.25 4V20H16.75V4H15.25Z" fill="currentColor"/>+ </g>+</svg>diff --git a/src/assets/icons/audio-wave.svg b/src/assets/icons/audio-wave.svgnew file mode 100644index 000000000..7ba84b1c3--- /dev/null+++ b/src/assets/icons/audio-wave.svg@@ -0,0 +1,9 @@+<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">+ <g id="icon" fill="currentColor">+ <path fill-rule="evenodd" clip-rule="evenodd" d="M3.25 7L3.25 17H4.75V7H3.25Z" />+ <path fill-rule="evenodd" clip-rule="evenodd" d="M19.25 7V17H20.75V7H19.25Z" />+ <path fill-rule="evenodd" clip-rule="evenodd" d="M7.25 4L7.25 20H8.75V4H7.25Z" />+ <path fill-rule="evenodd" clip-rule="evenodd" d="M12.75 7L12.75 17L11.25 17L11.25 7L12.75 7Z" />+ <path fill-rule="evenodd" clip-rule="evenodd" d="M15.25 4V20H16.75V4H15.25Z" />+ </g>+</svg>diff --git a/src/assets/icons/caret-down.svg b/src/assets/icons/caret-down.svgindex b043286ae..e9b21bc0b 100644--- a/src/assets/icons/caret-down.svg+++ b/src/assets/icons/caret-down.svg@@ -1,3 +1,3 @@-<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">- <path id="icon" d="M1.50002 1L7.00002 6L12.5 1" stroke="currentColor" stroke-width="1.5" fill="transparent" />+<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+ <path id="icon" fill-rule="evenodd" clip-rule="evenodd" d="M18.0045 10.555L12 16.0136L5.9955 10.555L7.00451 9.44507L12 13.9864L16.9955 9.44507L18.0045 10.555Z" fill="currentColor"/></svg>diff --git a/src/assets/icons/close.svg b/src/assets/icons/close.svgindex 633077a3e..8c64fc3f4 100644--- a/src/assets/icons/close.svg+++ b/src/assets/icons/close.svg@@ -1,5 +1,5 @@-<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">- <g id="icon" fill="currentColor">- <path d="M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z" />+<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+ <g id="icon">+ <path d="M5.40456 5L19 19M5 19L18.5954 5" stroke="currentColor" stroke-width="1.5"/></g></svg>diff --git a/src/assets/icons/ellipsis.svg b/src/assets/icons/ellipsis.svgnew file mode 100644index 000000000..27be2dee2--- /dev/null+++ b/src/assets/icons/ellipsis.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+ <path id="icon" d="M12 10.9998L12 12.9998M12 4.99982L12 6.99982M12 16.9998L12 18.9998" stroke="currentColor" stroke-width="2"/>+</svg>diff --git a/src/assets/icons/filter.svg b/src/assets/icons/filter.svgnew file mode 100644index 000000000..a5f9a30db--- /dev/null+++ b/src/assets/icons/filter.svg@@ -0,0 +1,7 @@+<svg fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">+ <g id="icon" fill="currentColor">+ <path d="m5 7h14v1.5h-14z"/>+ <path d="m7 11.25h10v1.5h-10z"/>+ <path d="m9 15.5h6v1.5h-6z"/>+ </g>+</svg>diff --git a/src/assets/icons/help.svg b/src/assets/icons/help.svgnew file mode 100644index 000000000..cd048e767--- /dev/null+++ b/src/assets/icons/help.svg@@ -0,0 +1,5 @@+<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+ <g id="icon">+ <path fill="none" d="M9.75 10.25C9.75 9.00736 10.7574 8 12 8C13.2426 8 14.25 9.00736 14.25 10.25C14.25 11.4083 13.3748 12.3621 12.2496 12.4863C12.1124 12.5015 12 12.6119 12 12.75V14M12 15V16.5M20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12Z" stroke="currentColor" stroke-width="1.5"/>+ </g>+ </svg>diff --git a/src/assets/icons/image-content.svg b/src/assets/icons/image-content.svgnew file mode 100644index 000000000..f7a44f392--- /dev/null+++ b/src/assets/icons/image-content.svg@@ -0,0 +1,6 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+ <g id="icon">+ <path fill-rule="evenodd" clip-rule="evenodd" d="M19 4.5H5C4.72386 4.5 4.5 4.72386 4.5 5V19C4.5 19.2761 4.72386 19.5 5 19.5H19C19.2761 19.5 19.5 19.2761 19.5 19V5C19.5 4.72386 19.2761 4.5 19 4.5ZM5 3C3.89543 3 3 3.89543 3 5V19C3 20.1046 3.89543 21 5 21H19C20.1046 21 21 20.1046 21 19V5C21 3.89543 20.1046 3 19 3H5Z" fill="currentColor"/>+ <path fill-rule="evenodd" clip-rule="evenodd" d="M15.4772 10.4623C15.7683 10.1792 16.2317 10.1792 16.5228 10.4623L20.5228 14.3511L19.4772 15.4266L16 12.046L12.5228 15.4266C12.2719 15.6706 11.8857 15.7086 11.5921 15.5183L8.59643 13.5766L4.44186 16.606L3.55811 15.394L8.12953 12.0607C8.38061 11.8776 8.71858 11.8683 8.97934 12.0373L11.906 13.9342L15.4772 10.4623Z" fill="currentColor"/>+ </g>+</svg>diff --git a/src/assets/icons/image.svg b/src/assets/icons/image.svgnew file mode 100644index 000000000..bf5751153--- /dev/null+++ b/src/assets/icons/image.svg@@ -0,0 +1,6 @@+<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">+ <g id="icon" fill="currentColor">+ <path fill-rule="evenodd" clip-rule="evenodd" d="M19 4.5H5C4.72386 4.5 4.5 4.72386 4.5 5V19C4.5 19.2761 4.72386 19.5 5 19.5H19C19.2761 19.5 19.5 19.2761 19.5 19V5C19.5 4.72386 19.2761 4.5 19 4.5ZM5 3C3.89543 3 3 3.89543 3 5V19C3 20.1046 3.89543 21 5 21H19C20.1046 21 21 20.1046 21 19V5C21 3.89543 20.1046 3 19 3H5Z"/>+ <path fill-rule="evenodd" clip-rule="evenodd" d="M15.4772 10.4623C15.7683 10.1792 16.2317 10.1792 16.5228 10.4623L20.5228 14.3511L19.4772 15.4266L16 12.046L12.5228 15.4266C12.2719 15.6706 11.8857 15.7086 11.5921 15.5183L8.59643 13.5766L4.44186 16.606L3.55811 15.394L8.12953 12.0607C8.38061 11.8776 8.71858 11.8683 8.97934 12.0373L11.906 13.9342L15.4772 10.4623Z"/>+ </g>+</svg>diff --git a/src/assets/icons/openverse-logo-text.svg b/src/assets/icons/openverse-logo-text.svgnew file mode 100644index 000000000..254ec78c1--- /dev/null+++ b/src/assets/icons/openverse-logo-text.svg@@ -0,0 +1,10 @@+<svg+ viewBox="0 0 95 15"+ xmlns="http://www.w3.org/2000/svg"+>+ <path+ fill-rule="evenodd"+ clip-rule="evenodd"+ d="M11.0953 6.14123C11.0953 9.02825 8.70687 11.3686 5.76056 11.3686C2.81424 11.3686 0.425781 9.02825 0.425781 6.14123C0.425781 3.25421 2.81424 0.913818 5.76056 0.913818C8.70687 0.913818 11.0953 3.25421 11.0953 6.14123ZM7.89439 6.14122C7.89439 7.29603 6.93901 8.23219 5.76049 8.23219C4.58196 8.23219 3.62658 7.29603 3.62658 6.14122C3.62658 4.98641 4.58196 4.05026 5.76049 4.05026C6.93901 4.05026 7.89439 4.98641 7.89439 6.14122ZM15.59 14.811H11.9299V1.08903H15.5635V2.83027H15.643C16.0409 1.81671 16.9957 0.959089 18.5074 0.959089C20.5231 0.959089 22.4858 2.46643 22.4858 6.07884C22.4858 9.53532 20.6558 11.1986 18.4809 11.1986C17.0487 11.1986 16.0674 10.4449 15.643 9.43136H15.59V14.811ZM17.1283 3.71388C16.1204 3.71388 15.5104 4.59749 15.5104 6.07884C15.5104 7.5342 16.1204 8.4438 17.1283 8.4438C18.1361 8.4438 18.7196 7.56018 18.7196 6.07884C18.7196 4.59749 18.1361 3.71388 17.1283 3.71388ZM33.3253 7.84606C32.9805 9.92514 31.1637 11.2506 28.3391 11.2506C25.0768 11.2506 23.0877 9.3339 23.0877 6.10482C23.0877 3.01218 25.1033 0.959089 28.2595 0.959089C31.3361 0.959089 33.3253 2.90173 33.3253 6.07884V6.91047H26.6947V7.0664C26.6947 8.02798 27.3312 8.72967 28.4186 8.72967C29.1679 8.72967 29.7713 8.41131 29.9835 7.84606H33.3253ZM28.3391 3.47998C27.4439 3.47998 26.7146 4.07122 26.6947 4.93534H29.9569C29.937 4.07772 29.2475 3.47998 28.3391 3.47998ZM37.9187 5.45511C37.9254 4.46754 38.4956 3.86981 39.404 3.86981C40.3256 3.86981 40.8693 4.46754 40.8627 5.45511V11.0686H44.5228V4.70144C44.5294 2.5314 43.1304 0.959089 40.9688 0.959089C39.4703 0.959089 38.2834 1.72575 37.8392 2.9862H37.7331V1.08903H34.2587V11.0686H37.9187V5.45511ZM51.8232 1.08903H55.6689L52.2476 11.0686H48.004L44.5826 1.08903H48.4283L50.0727 7.69013H50.1788L51.8232 1.08903ZM60.7199 11.2506C63.5445 11.2506 65.3613 9.92514 65.7061 7.84606H62.3643C62.1521 8.41131 61.5487 8.72967 60.7995 8.72967C59.7121 8.72967 59.0755 8.02798 59.0755 7.0664V6.91047H65.7061V6.07884C65.7061 2.90173 63.7169 0.959089 60.6403 0.959089C57.4842 0.959089 55.4685 3.01218 55.4685 6.10482C55.4685 9.3339 57.4577 11.2506 60.7199 11.2506ZM59.0755 4.93534C59.0954 4.07122 59.8248 3.47998 60.7199 3.47998C61.6283 3.47998 62.3179 4.07772 62.3378 4.93534H59.0755ZM70.2996 11.0686H66.6395V1.08903H70.1935V2.9862H70.2996C70.6709 1.58281 71.5196 0.959089 72.607 0.959089C72.9253 0.959089 73.2435 1.01107 73.5353 1.09553V4.15568C73.1706 4.03224 72.5606 3.97376 72.1826 3.97376C71.1019 3.97376 70.2996 4.72743 70.2996 5.87093V11.0686ZM83.4846 4.3376C83.3918 2.22603 81.6015 0.959089 78.6575 0.959089C75.7467 0.959089 73.9498 2.12857 73.9631 4.20766C73.9498 5.77997 74.9908 6.78702 77.0662 7.14437L78.8697 7.45623C79.6654 7.59917 80.0234 7.80708 80.0367 8.18391C80.0234 8.59973 79.5394 8.83362 78.8697 8.83362C78.0409 8.83362 77.4574 8.48278 77.3579 7.84606H73.7244C73.9233 9.89266 75.7268 11.2506 78.8432 11.2506C81.6612 11.2506 83.7366 9.90565 83.7498 7.76809C83.7366 6.29324 82.7287 5.43562 80.6467 5.06528L78.578 4.70144C77.8022 4.565 77.5834 4.29212 77.5966 3.99975C77.5834 3.58393 78.1072 3.35004 78.7371 3.35004C79.4598 3.35004 80.0632 3.72687 80.1163 4.3376H83.4846ZM94.4583 7.84606C94.1135 9.92514 92.2968 11.2506 89.4721 11.2506C86.2099 11.2506 84.2207 9.3339 84.2207 6.10482C84.2207 3.01218 86.2364 0.959089 89.3926 0.959089C92.4692 0.959089 94.4583 2.90173 94.4583 6.07884V6.91047H87.8278V7.0664C87.8278 8.02798 88.4643 8.72967 89.5517 8.72967C90.301 8.72967 90.9044 8.41131 91.1165 7.84606H94.4583ZM89.4721 3.47998C88.577 3.47998 87.8477 4.07122 87.8278 4.93534H91.09C91.0701 4.07772 90.3805 3.47998 89.4721 3.47998Z"+ />+</svg>diff --git a/src/assets/icons/video-content.svg b/src/assets/icons/video-content.svgnew file mode 100644index 000000000..625e97a14--- /dev/null+++ b/src/assets/icons/video-content.svg@@ -0,0 +1,6 @@+<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+ <g id="icon" fill="none" stroke="currentColor">+ <rect x="3.75" y="3.75" width="16.5" height="16.5" rx="1.53571" stroke-width="1.5"/>+ <path d="M10 15V9L15 12L10 15Z" fill="currentColor"/>+</g>+</svg>diff --git a/src/assets/oops.svg b/src/assets/oops.svgnew file mode 100644index 000000000..2750db49d--- /dev/null+++ b/src/assets/oops.svg@@ -0,0 +1,10 @@+<svg+ viewBox="0 0 1320 569"+ xmlns="http://www.w3.org/2000/svg"+>+ <path d="M199.235 406.514C172.831 406.514 147.626 401.917 123.622 392.724C99.6177 383.131 78.4139 369.74 60.0107 352.552C41.6074 334.965 27.0048 314.179 16.2029 290.196C5.40096 265.813 0 238.832 0 209.253C0 182.072 4.40078 156.09 13.2023 131.308C22.0039 106.125 35.0062 83.7411 52.2093 64.1549C69.4123 44.5687 90.8161 28.9796 116.421 17.3878C142.025 5.79592 171.43 0 204.636 0C231.041 0 256.246 4.79663 280.25 14.3899C304.254 23.5834 325.458 36.974 343.861 54.5616C362.264 71.7496 376.867 92.5349 387.669 116.918C398.471 140.901 403.872 167.682 403.872 197.261C403.872 224.043 399.471 250.024 390.669 275.207C381.868 300.389 368.866 322.773 351.663 342.359C334.459 361.946 313.056 377.535 287.451 389.126C261.847 400.718 232.441 406.514 199.235 406.514ZM208.237 382.531C239.042 382.531 264.647 376.136 285.051 363.345C305.454 350.154 320.657 331.967 330.659 308.783C341.061 285.2 346.262 257.819 346.262 226.641C346.262 199.06 343.061 173.078 336.66 148.695C330.259 124.313 320.657 102.928 307.855 84.5406C295.453 65.7538 279.85 51.164 261.046 40.7713C242.243 30.3786 220.239 25.1823 195.035 25.1823C165.029 25.1823 139.825 31.5778 119.421 44.3688C99.0176 57.1598 83.6149 75.1472 73.213 98.3309C62.8112 121.115 57.6102 148.096 57.6102 179.274C57.6102 207.254 60.6108 233.436 66.6118 257.819C73.013 282.202 82.4146 303.786 94.8168 322.573C107.619 341.36 123.422 356.15 142.225 366.942C161.029 377.335 183.033 382.531 208.237 382.531Z" />+ <path d="M565.118 406.514C542.714 406.514 522.51 401.318 504.507 390.925C486.504 380.532 472.101 366.342 461.299 348.355C450.897 329.968 445.696 309.183 445.696 285.999C445.696 269.211 448.897 252.822 455.298 236.834C462.099 220.845 471.501 206.255 483.503 193.064C495.505 179.874 509.508 169.481 525.51 161.886C541.513 153.892 558.716 149.895 577.12 149.895C600.324 149.895 621.128 155.491 639.531 166.683C658.334 177.875 673.137 192.665 683.939 211.052C695.141 229.039 700.742 248.825 700.742 270.41C700.742 293.594 695.541 315.578 685.139 336.364C675.137 357.149 660.134 374.137 640.131 387.328C620.127 400.119 595.123 406.514 565.118 406.514ZM577.72 388.527C591.322 388.527 603.524 385.929 614.326 380.732C625.128 375.536 633.53 367.142 639.531 355.55C644.332 346.357 647.532 335.164 649.133 321.974C650.733 308.783 651.533 296.392 651.533 284.8C651.533 265.613 647.932 247.226 640.731 229.639C633.93 211.651 624.128 197.061 611.326 185.869C598.924 174.277 584.121 168.482 566.918 168.482C556.116 168.482 546.314 170.28 537.513 173.878C529.111 177.076 521.31 183.271 514.108 192.465C506.107 202.458 500.906 214.649 498.506 229.039C496.105 243.429 494.905 257.819 494.905 272.209C494.905 291.795 498.506 310.582 505.707 328.569C512.908 346.157 522.71 360.547 535.112 371.739C547.514 382.931 561.717 388.527 577.72 388.527Z" />+ <path d="M739.819 569C737.819 569 735.218 568.6 732.018 567.801C728.817 567.401 727.217 566.002 727.217 563.604C727.217 560.406 728.617 558.008 731.417 556.409C734.618 555.21 737.819 554.01 741.019 552.811C747.02 550.813 752.821 548.414 758.422 545.616C764.023 543.218 766.824 538.022 766.824 530.027V226.041C766.824 222.843 765.823 218.047 763.823 211.651C762.223 205.256 759.422 199.06 755.422 193.064C751.421 187.068 746.02 183.471 739.219 182.272C737.618 181.872 736.418 180.873 735.618 179.274C734.818 177.675 734.418 176.076 734.418 174.477C734.418 172.479 734.818 170.88 735.618 169.681C736.418 168.482 737.419 167.682 738.619 167.282C753.821 163.685 766.824 159.888 777.626 155.89C788.427 151.494 798.629 147.296 808.231 143.299C808.631 143.299 808.831 143.299 808.831 143.299C808.831 142.9 809.031 142.7 809.431 142.7C810.231 142.7 811.031 143.299 811.832 144.498C812.632 145.698 813.032 146.897 813.032 148.096C813.032 151.693 812.432 157.489 811.232 165.484C810.431 173.078 810.031 179.274 810.031 184.071C810.031 187.268 810.231 189.067 810.632 189.467C814.632 185.47 821.833 180.473 832.235 174.477C843.037 168.082 855.239 162.486 868.842 157.689C882.444 152.493 895.447 149.895 907.849 149.895C928.652 149.895 946.256 155.491 960.658 166.683C975.461 177.475 986.663 191.665 994.264 209.253C1002.27 226.441 1006.27 244.428 1006.27 263.215C1006.27 281.202 1002.87 298.79 996.064 315.978C989.263 332.766 979.662 347.955 967.259 361.546C954.857 375.136 940.455 386.129 924.052 394.523C907.649 402.517 890.046 406.514 871.242 406.514C865.641 406.514 858.84 405.515 850.839 403.516C843.237 401.917 835.636 399.719 828.035 396.921C820.833 394.123 815.232 390.925 811.232 387.328C810.832 387.328 810.431 389.726 810.031 394.523C809.631 398.92 809.231 403.516 808.831 408.313C808.831 413.509 808.831 416.707 808.831 417.906V530.027C808.831 535.224 810.832 539.221 814.832 542.019C819.233 545.217 824.034 547.415 829.235 548.614C834.836 550.213 839.637 551.612 843.637 552.811C846.838 554.01 849.838 555.21 852.639 556.409C855.839 558.008 857.44 560.406 857.44 563.604C857.44 566.002 855.839 567.401 852.639 567.801C849.438 568.6 846.638 569 844.237 569C832.635 569 822.834 568.4 814.832 567.201C807.231 566.402 798.229 566.002 787.827 566.002C781.026 566.002 775.425 566.202 771.024 566.602C767.024 567.001 762.823 567.401 758.422 567.801C754.021 568.6 747.82 569 739.819 569ZM880.244 387.927C886.245 387.927 893.446 386.129 901.848 382.531C910.649 378.934 919.251 373.138 927.652 365.143C936.454 357.149 943.655 346.357 949.256 332.766C955.257 319.176 958.258 302.387 958.258 282.401C958.258 259.218 955.257 240.631 949.256 226.641C943.255 212.651 935.854 202.058 927.052 194.863C918.251 187.668 909.249 182.871 900.047 180.473C890.846 178.075 883.044 176.876 876.643 176.876C867.042 176.876 857.04 178.874 846.638 182.871C836.636 186.869 828.035 191.465 820.833 196.662C814.032 201.458 810.632 205.256 810.632 208.054C810.632 216.848 810.431 225.841 810.031 235.035C810.031 243.829 809.831 252.423 809.431 260.817C809.431 269.211 809.231 276.805 808.831 283.601C808.831 289.996 808.831 294.993 808.831 298.59C808.831 314.579 812.432 329.368 819.633 342.959C827.234 356.549 836.436 367.542 847.238 375.936C858.44 383.93 869.442 387.927 880.244 387.927Z" />+ <path d="M1107.42 406.514C1095.01 406.514 1083.41 404.516 1072.61 400.518C1061.81 396.921 1052.61 391.725 1045.01 384.929C1043.01 380.533 1041.41 373.138 1040.21 362.745C1039.4 352.352 1038.8 343.758 1038.4 336.963C1038.4 333.366 1041.01 331.567 1046.21 331.567C1047.81 331.567 1049.21 331.967 1050.41 332.766C1052.01 333.166 1053.01 334.165 1053.41 335.764C1058.61 355.35 1066.81 369.34 1078.01 377.734C1089.61 386.129 1101.22 390.326 1112.82 390.326C1124.42 390.326 1134.22 386.528 1142.22 378.934C1150.62 370.939 1154.83 361.146 1154.83 349.554C1154.83 338.762 1151.22 329.568 1144.02 321.974C1136.82 313.979 1124.22 304.386 1106.22 293.194C1092.61 284.8 1081.61 276.805 1073.21 269.211C1064.81 261.616 1058.61 253.822 1054.61 245.827C1051.01 237.833 1049.21 228.839 1049.21 218.846C1049.21 206.055 1052.21 194.463 1058.21 184.071C1064.21 173.678 1073.21 165.484 1085.21 159.488C1097.22 153.092 1112.22 149.895 1130.22 149.895C1142.22 149.895 1152.22 151.094 1160.23 153.492C1168.23 155.89 1174.23 158.489 1178.23 161.287C1181.43 165.684 1184.03 172.679 1186.03 182.272C1188.43 191.465 1189.63 200.259 1189.63 208.653C1189.63 211.451 1187.63 212.85 1183.63 212.85C1181.23 212.85 1178.83 212.451 1176.43 211.651C1174.43 210.452 1173.03 209.053 1172.23 207.454C1167.03 194.263 1160.43 184.27 1152.43 177.475C1144.82 170.28 1135.22 166.683 1123.62 166.683C1113.62 166.683 1104.62 169.681 1096.62 175.676C1089.01 181.672 1085.21 190.466 1085.21 202.058C1085.21 211.251 1088.01 219.446 1093.61 226.641C1099.62 233.836 1110.62 242.03 1126.62 251.223C1149.82 264.414 1167.03 276.805 1178.23 288.397C1189.83 299.589 1195.63 314.579 1195.63 333.366C1195.63 354.95 1187.43 372.538 1171.03 386.129C1154.63 399.719 1133.42 406.514 1107.42 406.514Z" />+ <path d="M1282.79 275.207C1279.99 275.207 1277.59 273.608 1275.59 270.41C1273.99 266.812 1272.79 260.617 1271.99 251.823C1270.39 234.635 1268.59 216.048 1266.59 196.062C1264.59 175.676 1262.79 155.491 1261.19 135.505C1259.99 115.519 1258.79 97.3316 1257.59 80.9431C1256.79 64.5546 1256.39 51.5637 1256.39 41.9705C1256.39 33.1767 1258.99 25.582 1264.19 19.1865C1269.79 12.3913 1276.59 8.99367 1284.59 8.99367C1292.6 8.99367 1299 12.3913 1303.8 19.1865C1309 25.582 1311.6 33.1767 1311.6 41.9705C1311.6 51.5637 1311 64.5546 1309.8 80.9431C1308.6 97.3316 1307 115.519 1305 135.505C1303.4 155.491 1301.6 175.676 1299.6 196.062C1297.6 216.448 1295.6 235.035 1293.6 251.823C1293.2 258.218 1292 263.815 1289.99 268.611C1288.39 273.008 1285.99 275.207 1282.79 275.207ZM1283.99 406.514C1273.99 406.514 1265.39 403.117 1258.19 396.321C1251.39 389.126 1247.99 380.532 1247.99 370.539C1247.99 360.547 1251.39 352.152 1258.19 345.357C1265.39 338.162 1273.99 334.565 1283.99 334.565C1294 334.565 1302.4 338.162 1309.2 345.357C1316.4 352.152 1320 360.547 1320 370.539C1320 380.532 1316.4 389.126 1309.2 396.321C1302.4 403.117 1294 406.514 1283.99 406.514Z" />+</svg>diff --git a/src/components/AudioThumbnail/AudioThumbnail.vue b/src/components/AudioThumbnail/AudioThumbnail.vuedeleted file mode 100644index c21415f60..000000000--- a/src/components/AudioThumbnail/AudioThumbnail.vue+++ /dev/null@@ -1,40 +0,0 @@-<template>- <!-- Should be wrapped by a fixed-width parent -->- <div class="relative h-0 w-full pt-full" :title="helpText">- <div class="thumbnail absolute inset-0 bg-yellow">- <img- v-if="audio.thumbnail"- class="h-full w-full object-cover object-center overflow-clip"- :src="audio.thumbnail"- :alt="helpText"- />- </div>- </div>-</template>--<script>-/**- * Displays the cover art for the audio in a square aspect ratio.- */-export default {- name: 'AudioThumbnail',- props: {- /**- * the details of the audio whose artwork is to be shown; The properties- * `thumbnail`, `title` and `creator` are used.- */- audio: {- type: Object,- required: true,- },- },- computed: {- helpText() {- return this.$t('audio-thumbnail.alt', {- title: this.audio.title,- creator: this.audio.creator,- })- },- },-}-</script>diff --git a/src/components/Header/SearchBar/SearchButton.vue b/src/components/Header/SearchBar/SearchButton.vuedeleted file mode 100644index 86c8394cb..000000000--- a/src/components/Header/SearchBar/SearchButton.vue+++ /dev/null@@ -1,25 +0,0 @@-<template>- <VIconButton- v-bind="$attrs"- size="search"- class="search-button hover:text-white group-hover:text-white hover:bg-pink group-hover:bg-pink p-0.5px ps-1.5px focus:p-0 border border-s-0 focus:border-1.5 border-dark-charcoal-20 hover:border-pink group-hover:border-pink rounded-e-sm active:shadow-ring"- :icon-props="{ iconPath: searchIcon }"- :aria-label="$t('search.search')"- v-on="$listeners"- />-</template>--<script>-import VIconButton from '~/components/VIconButton/VIconButton.vue'--import searchIcon from '~/assets/icons/search.svg'--export default {- name: 'SearchButton',- components: { VIconButton },- inheritAttrs: false,- setup() {- return { searchIcon }- },-}-</script>diff --git a/src/components/HeaderSection.vue b/src/components/HeaderSection.vuedeleted file mode 100644index ffa59d24e..000000000--- a/src/components/HeaderSection.vue+++ /dev/null@@ -1,16 +0,0 @@-<template>- <header class="embedded">- <NavSection :key="$route.path" :show-nav-search="showNavSearch" />- <NotificationBanner v-if="showNotification" />- </header>-</template>--<script>-export default {- name: 'HeaderSection',- props: {- showNavSearch: { type: Boolean, default: false },- showNotification: { type: Boolean, default: false },- },-}-</script>diff --git a/src/components/ImageDetails/VPhotoDetails.vue b/src/components/ImageDetails/VPhotoDetails.vueindex 3a59a977a..0db96ac65 100644--- a/src/components/ImageDetails/VPhotoDetails.vue+++ b/src/components/ImageDetails/VPhotoDetails.vue@@ -235,7 +235,9 @@ export default {() => `${props.image.license_url}?ref=openverse`)- const goBackToSearchResults = () => router.back()+ const goBackToSearchResults = () => {+ router.back()+ }const onImageLoad = (event) => emit('onImageLoaded', event)const tabClass = (tabIdx, tabClass) => {diff --git a/src/components/ImageGrid/ImageGrid.vue b/src/components/ImageGrid/ImageGrid.vueindex 45d1df9e6..df1a8d271 100644--- a/src/components/ImageGrid/ImageGrid.vue+++ b/src/components/ImageGrid/ImageGrid.vue@@ -6,14 +6,14 @@<h5 v-if="isError" class="image-grid__notification py-4">{{ fetchState.fetchingError }}</h5>- <LoadMoreButton- v-if="canLoadMore"- :is-error="isError"- :is-fetching="fetchState.isFetching"- :is-finished="fetchState.isFinished"- data-testid="load-more"- @onLoadMore="onLoadMore"- />+ <footer class="px-2">+ <VLoadMore+ v-if="canLoadMore && !fetchState.isFinished"+ :is-fetching="fetchState.isFetching"+ data-testid="load-more"+ @onLoadMore="onLoadMore"+ />+ </footer></section></template>@@ -25,12 +25,12 @@* or display 'No More Media'.* Used to display both image search results, and related images.*/-import LoadMoreButton from '~/components/ImageGrid/LoadMoreButton'+import VLoadMore from '~/components/VLoadMore'import ImageCell from '~/components/ImageGrid/ImageCell'export default {name: 'ImageGrid',- components: { LoadMoreButton, ImageCell },+ components: { VLoadMore, ImageCell },props: {images: {default: () => [],diff --git a/src/components/ImageGrid/LoadMoreButton.vue b/src/components/ImageGrid/LoadMoreButton.vuedeleted file mode 100644index e9e4401fe..000000000--- a/src/components/ImageGrid/LoadMoreButton.vue+++ /dev/null@@ -1,86 +0,0 @@-<template>- <div v-show="!isError" class="load-more pb-6">- <button- v-show="!isFetching"- class="button"- :disabled="isFinished"- @click="onLoadMore"- @keyup.enter="onLoadMore"- >- <span>{{ buttonLabel }}</span>- </button>- <LoadingIcon v-show="isFetching" />- </div>-</template>-<script>-import LoadingIcon from '~/components/LoadingIcon'--export default {- name: 'LoadMoreButton',- components: { LoadingIcon },- props: {- isFetching: {- type: Boolean,- default: true,- },- isFinished: {- type: Boolean,- default: false,- },- isError: {- type: Boolean,- default: false,- },- mediaType: {- type: String,- default: 'image',- },- },- computed: {- finishedLabel() {- const type = this.$t(`browse-page.search-form.${this.mediaType}`)- return this.$t('browse-page.no-more', { type })- },- buttonLabel() {- return this.isFinished ? this.finishedLabel : this.$t('browse-page.load')- },- },- methods: {- onLoadMore() {- this.$emit('onLoadMore')- },- },-}-</script>-<style lang="scss" scoped>-.load-more {- display: flex;- justify-content: center;-}-button {- color: #23282d;- margin-top: 2rem;- border: 1px solid rgba(35, 40, 45, 0.2);- font-size: 1.2em;-- &:hover {- color: white;- }-- &:disabled {- opacity: 1;-- &:hover {- color: black;- }- }-- @include mobile {- padding: 0.5rem;-- span {- font-size: 0.9rem;- }- }-}-</style>diff --git a/src/components/SearchGridForm.vue b/src/components/SearchGridForm.vueindex 565ee5078..3575b018f 100644--- a/src/components/SearchGridForm.vue+++ b/src/components/SearchGridForm.vue@@ -6,18 +6,7 @@class="search-form p-4 z-30"@submit.prevent="onSubmit">- <button- v-if="!isFilterVisible"- class="button filter-toggle"- type="button"- @click="onToggleSearchGridFilter"- >- {{ $t('filters.title') }}- </button>- <div- class="search-field field has-addons control search-control"- :class="{ 'ms-2': !isFilterVisible }"- >+ <div class="search-field field has-addons control search-control"><label for="searchInput" class="search-field__label control label"><inputid="searchInput"@@ -68,7 +57,7 @@ export default {name: 'SearchGridForm',data: () => ({ searchTermsModel: null }),computed: {- ...mapState(SEARCH, ['isFilterVisible', 'query']),+ ...mapState(SEARCH, ['query']),searchTerms() {return this.query.q},@@ -108,11 +97,6 @@ export default {})}},- onToggleSearchGridFilter() {- this.setFilterIsVisible({- isFilterVisible: !this.isFilterVisible,- })- },setFormInput() {this.searchTermsModel = this.searchTerms},@@ -121,9 +105,6 @@ export default {</script><style lang="scss" scoped>-.filter-toggle {- @apply h-10 lg:h-14 text-2xl hover:border-tx p-2 border-light-gray normal-case;-}.search-icon {@apply start-0 text-light-gray w-10 h-10 absolute items-center inline-flex justify-center pointer-events-none;}diff --git a/src/components/VAudioThumbnail/VAudioThumbnail.vue b/src/components/VAudioThumbnail/VAudioThumbnail.vuenew file mode 100644index 000000000..46d1a3e48--- /dev/null+++ b/src/components/VAudioThumbnail/VAudioThumbnail.vue@@ -0,0 +1,149 @@+<template>+ <!-- Should be wrapped by a fixed-width parent -->+ <div class="relative h-0 w-full pt-full" :title="helpText">+ <div class="thumbnail absolute inset-0 bg-yellow">+ <img+ v-if="audio.thumbnail && ok"+ class="h-full w-full object-cover object-center overflow-clip"+ :src="audio.thumbnail"+ :alt="helpText"+ @error="handleError"+ />++ <!-- Programmatic thumbnail -->+ <svg+ v-else+ class="h-full w-full"+ :viewBox="`0 0 ${canvasSize} ${canvasSize}`"+ >+ <template v-for="i in dotCount">+ <circle+ v-for="j in dotCount"+ :key="`${i}-${j}`"+ class="fill-dark-charcoal"+ :cx="offset(j)"+ :cy="offset(i)"+ :r="radius(i, j)"+ />+ </template>+ </svg>+ </div>+ </div>+</template>++<script>+import { ref } from '@nuxtjs/composition-api'++/**+ * Displays the cover art for the audio in a square aspect ratio.+ */+export default {+ name: 'VAudioThumbnail',+ props: {+ /**+ * the details of the audio whose artwork is to be shown; The properties+ * `thumbnail`, `title` and `creator` are used.+ */+ audio: {+ type: Object,+ required: true,+ },+ },+ setup() {+ /* Switching */++ const ok = ref(true)+ const handleError = () => {+ ok.value = false+ }++ /* Math utilities */++ /**+ * Perform linear interpolation to find a value that is fractionally between+ * the low and high limits of the given range.+ *+ * @param {number} low - the lower limit of the range+ * @param {number} high - the upper limit of the range+ * @param {number} frac - fraction controlling position of interpolated number+ * @returns {number} the interpolated number+ */+ const lerp = (low, high, frac) => low + (high - low) * frac++ /**+ * Interpolate twice to solve the Bézier equation for three points P0, P1+ * and P2.+ *+ * @param {[number, number]} p0 - point #0+ * @param {[number, number]} p1 - point #1+ * @param {[number, number]} p2 - point #2+ * @param {number} frac - the fraction at which to solve the Bézier equation+ * @returns {[number,number]} a solution to the 3-point Bézier equation+ */+ const doubleLerp = (p0, p1, p2, frac) => [+ lerp(lerp(p0[0], p1[0], frac), lerp(p1[0], p2[0], frac), frac),+ lerp(lerp(p0[1], p1[1], frac), lerp(p1[1], p2[1], frac), frac),+ ]++ /**+ * Find the distance between two points P0 and P1.+ *+ * @param {[number, number]} p0 - point #0+ * @param {[number, number]} p1 - point #1+ * @returns {number} the distance between the two points+ */+ const dist = (p0, p1) =>+ Math.sqrt(Math.pow(p0[0] - p1[0], 2) + Math.pow(p0[1] - p1[1], 2))++ /* Artwork */++ const dotCount = 10+ const canvasSize = 768+ const minRadius = 2+ const maxRadius = 27++ const ctrlPts = Array.from({ length: 4 }, (_, idx) => [+ Math.random() * canvasSize,+ (idx / 3) * canvasSize,+ ])++ const pointCount = dotCount + 1+ const bezierPoints = []+ for (let i = 0; i <= pointCount; i++) {+ const frac = i / pointCount+ const a = doubleLerp(ctrlPts[0], ctrlPts[1], ctrlPts[2], frac)+ const b = doubleLerp(ctrlPts[1], ctrlPts[2], ctrlPts[3], frac)+ const x = lerp(a[0], b[0], frac)+ bezierPoints.push(x)+ }++ const offset = (i) => {+ return i * (canvasSize / (dotCount + 1))+ }+ const radius = (i, j) => {+ const bezierPoint = bezierPoints[i]+ const distance = dist([0, bezierPoint], [0, offset(j)])+ const maxFeasibleDistance = canvasSize * ((dotCount - 1) / (dotCount + 1))+ return lerp(maxRadius, minRadius, distance / maxFeasibleDistance)+ }++ return {+ ok,+ handleError,++ canvasSize,+ dotCount,+ offset,+ radius,+ }+ },+ computed: {+ helpText() {+ return this.$t('audio-thumbnail.alt', {+ title: this.audio.title,+ creator: this.audio.creator,+ })+ },+ },+}+</script>diff --git a/src/components/AudioThumbnail/meta/AudioThumbnail.stories.mdx b/src/components/VAudioThumbnail/meta/VAudioThumbnail.stories.mdxsimilarity index 89%rename from src/components/AudioThumbnail/meta/AudioThumbnail.stories.mdxrename to src/components/VAudioThumbnail/meta/VAudioThumbnail.stories.mdxindex aa0d2beff..7716d019f 100644--- a/src/components/AudioThumbnail/meta/AudioThumbnail.stories.mdx+++ b/src/components/VAudioThumbnail/meta/VAudioThumbnail.stories.mdx@@ -6,11 +6,11 @@ import {Story,} from '@storybook/addon-docs'-import AudioThumbnail from '~/components/AudioThumbnail/AudioThumbnail.vue'+import VAudioThumbnail from '~/components/VAudioThumbnail/VAudioThumbnail.vue'<Meta- title="Components/Audio thumbnail"- components={AudioThumbnail}+ title="Components/VAudioThumbnail"+ components={VAudioThumbnail}argTypes={{toggle: {action: 'toggle',@@ -21,18 +21,18 @@ import AudioThumbnail from '~/components/AudioThumbnail/AudioThumbnail.vue'export const Template = (args, { argTypes }) => ({template: `<div class="w-30">- <AudioThumbnail v-bind="$props" v-on="$props"/>+ <VAudioThumbnail v-bind="$props" v-on="$props"/></div>`,- components: { AudioThumbnail },+ components: { VAudioThumbnail },props: Object.keys(argTypes),})-# Audio thumbnail+# VAudioThumbnail-<Description of={AudioThumbnail} />+<Description of={VAudioThumbnail} />-<ArgsTable of={AudioThumbnail} />+<ArgsTable of={VAudioThumbnail} />It does not have any intrinsic width and scales horizontally to take up the fullwidth of the parent. It also does not have any rounding so the parent layout@@ -129,7 +129,7 @@ André Karwath aka [Aka](https://commons.wikimedia.org/wiki/User:Aka)## Fallback-In the absence of album art, some generic imagery can be shown.+In the absence of album art, a randomised artwork is generated.<Canvas><Storydiff --git a/src/components/VAudioTrack/VWaveform.vue b/src/components/VAudioTrack/VWaveform.vueindex 977abde93..74fd28a40 100644--- a/src/components/VAudioTrack/VWaveform.vue+++ b/src/components/VAudioTrack/VWaveform.vue@@ -27,6 +27,7 @@><!-- Stroke is calculated from the centre of the path --><rect+ v-if="waveformDimens.width && waveformDimens.height"class="stroke-pink"x="0.75"y="0.75"@@ -37,6 +38,7 @@stroke-width="1.5"/><rect+ v-if="waveformDimens.width && waveformDimens.height"class="stroke-white"x="2"y="2"diff --git a/src/components/VAudioTrack/layouts/VGlobalLayout.vue b/src/components/VAudioTrack/layouts/VGlobalLayout.vueindex 1626e5ff8..3e4b2be40 100644--- a/src/components/VAudioTrack/layouts/VGlobalLayout.vue+++ b/src/components/VAudioTrack/layouts/VGlobalLayout.vue@@ -1,7 +1,7 @@<template><div class="global-track flex flex-row w-full"><div class="flex-shrink-0">- <AudioThumbnail :audio="audio" />+ <VAudioThumbnail :audio="audio" /><slot name="play-pause" size="medium" /></div>@@ -20,12 +20,12 @@<script>import { defineComponent } from '@nuxtjs/composition-api'-import AudioThumbnail from '~/components/AudioThumbnail/AudioThumbnail.vue'+import VAudioThumbnail from '~/components/VAudioThumbnail/VAudioThumbnail.vue'export default defineComponent({name: 'VGlobalLayout',components: {- AudioThumbnail,+ VAudioThumbnail,},props: ['audio'],})diff --git a/src/components/VAudioTrack/layouts/VRowLayout.vue b/src/components/VAudioTrack/layouts/VRowLayout.vueindex f1784b328..d539c657a 100644--- a/src/components/VAudioTrack/layouts/VRowLayout.vue+++ b/src/components/VAudioTrack/layouts/VRowLayout.vue@@ -4,7 +4,7 @@class="relative flex-shrink-0 rounded-sm overflow-hidden":class="isLarge ? 'w-30 me-6' : 'w-20 me-4'">- <AudioThumbnail :audio="audio" />+ <VAudioThumbnail :audio="audio" /><div v-if="isSmall" class="absolute bottom-0 end-0"><slot name="play-pause" size="tiny" /></div>@@ -80,13 +80,13 @@<script>import { computed, defineComponent } from '@nuxtjs/composition-api'-import AudioThumbnail from '~/components/AudioThumbnail/AudioThumbnail.vue'+import VAudioThumbnail from '~/components/VAudioThumbnail/VAudioThumbnail.vue'import VLicense from '~/components/License/VLicense.vue'export default defineComponent({name: 'VRowLayout',components: {- AudioThumbnail,+ VAudioThumbnail,VLicense,},props: ['audio', 'size'],diff --git a/src/components/VButton.vue b/src/components/VButton.vueindex 0110cbbf9..f13b16178 100644--- a/src/components/VButton.vue+++ b/src/components/VButton.vue@@ -2,6 +2,7 @@<Component:is="as":type="typeRef"+ class="transition-colors":class="[$style.button,$style[variant],@@ -72,6 +73,7 @@ const VButton = defineComponent({'secondary','tertiary','action-menu',+ 'action-menu-secondary','action-menu-muted','grouped',].includes(v),@@ -249,9 +251,17 @@ a.button {}.action-menu {+ @apply bg-white text-black border border-dark-charcoal-20 hover:border-dark-charcoal-20 focus-visible:ring-pink;+}++.action-menu-secondary {@apply bg-white text-black border border-tx hover:border-dark-charcoal-20 focus-visible:ring-pink;}+.action-menu-secondary-pressed {+ @apply border-tx bg-dark-charcoal text-white;+}+.action-menu-pressed {@apply border-tx bg-dark-charcoal text-white;}@@ -261,7 +271,7 @@ a.button {}.action-menu-muted-pressed {- @apply border-tx bg-dark-charcoal text-white;+ @apply border-tx bg-dark-charcoal text-white focus-visible:ring-pink;}.grouped {@@ -272,6 +282,14 @@ a.button {@apply bg-dark-charcoal-10 ring-offset-dark-charcoal-10;}+.full {+ @apply w-full font-semibold bg-dark-charcoal-06 focus-visible:ring-pink hover:bg-dark-charcoal-40 hover:text-white;+}++.full-pressed {+ @apply w-full font-semibold bg-dark-charcoal-06 text-dark-charcoal;+}+.plain {@apply bg-tx focus-visible:ring-pink;}diff --git a/src/components/VContentLink/VContentLink.vue b/src/components/VContentLink/VContentLink.vuenew file mode 100644index 000000000..b96e6320a--- /dev/null+++ b/src/components/VContentLink/VContentLink.vue@@ -0,0 +1,95 @@+<template>+ <button+ class="bg-white border border-dark-charcoal/20 rounded-sm flex hover:bg-dark-charcoal hover:text-white focus:bg-white focus:border-tx focus:ring focus:ring-pink focus:outline-none focus:shadow-ring focus:text-black overflow-hidden"+ :class="[+ isStacked+ ? 'flex-col items-start py-4 ps-4 pe-12'+ : 'flex-row justify-between items-center w-full min-w-[22rem] p-6',+ ]"+ role="radio"+ type="button"+ :aria-checked="isSelected"+ v-on="$listeners"+ >+ <div+ class="flex"+ :class="[isStacked ? 'flex-col items-start' : ' flex-row items-center']"+ >+ <VIcon :icon-path="iconPath" />+ <p class="font-semibold" :class="[isStacked ? 'pt-1' : 'ps-2 text-2xl']">+ {{+ isStacked+ ? $t(`search-tab.${mediaType}`)+ : $t(`search-tab.see-${mediaType}`)+ }}+ </p>+ </div>+ <span :class="{ 'text-sr': !isStacked }">{{ resultsCountLabel }}</span>+ </button>+</template>++<script>+import { computed, defineComponent } from '@nuxtjs/composition-api'+import { resultsCount } from '~/composables/use-i18n-utilities'+import { AUDIO, IMAGE, mediaTypes } from '~/constants/media'+import VIcon from '~/components/VIcon/VIcon.vue'++import audioIcon from '~/assets/icons/audio-wave.svg'+import imageIcon from '~/assets/icons/image.svg'++export default defineComponent({+ name: 'VContentLink',+ components: { VIcon },+ props: {+ /**+ * One of the media types supported.+ */+ mediaType: {+ type: String,+ required: true,+ validator: (val) => mediaTypes.includes(val),+ },+ /**+ * The number of results that the search returned.+ */+ resultsCount: {+ type: Number,+ required: true,+ },+ /**+ * Whether the indicated media type is currently selected.+ */+ isSelected: {+ type: Boolean,+ default: false,+ },+ /**+ * `stacked` intended for mobile and `horizontal` for desktop.+ */+ layout: {+ type: String,+ default: 'stacked',+ validator: (val) => ['stacked', 'horizontal'].includes(val),+ },+ },+ setup(props) {+ const iconMapping = {+ [AUDIO]: audioIcon,+ [IMAGE]: imageIcon,+ }+ const iconPath = computed(() => iconMapping[props.mediaType])++ const resultsCountLabel = computed(() => resultsCount(props.resultsCount))++ const isStacked = computed(() => props.layout == 'stacked')++ return { iconPath, imageIcon, resultsCountLabel, isStacked }+ },+})+</script>++<style scoped>+button[aria-checked='true'] {+ @apply bg-dark-charcoal text-white;+}+</style>diff --git a/src/components/VContentLink/meta/VContentLink.stories.js b/src/components/VContentLink/meta/VContentLink.stories.jsnew file mode 100644index 000000000..31cba88d2--- /dev/null+++ b/src/components/VContentLink/meta/VContentLink.stories.js@@ -0,0 +1,83 @@+import VContentLink from '~/components/VContentLink/VContentLink.vue'++export default {+ title: 'Components/VContentLink',+ component: VContentLink,+ argTypes: {+ mediaType: {+ options: ['audio', 'image'],+ control: { type: 'radio' },+ },+ resultsCount: {+ control: { type: 'number' },+ },+ isSelected: {+ control: { type: 'boolean' },+ },+ layout: {+ options: ['stacked', 'horizontal'],+ control: { type: 'radio' },+ },+ },+}++const VContentLinkStory = (args, { argTypes }) => ({+ template: `<VContentLink v-bind="$props" />`,+ components: { VContentLink },+ props: Object.keys(argTypes),+})++const TwoVContentLinkStory = () => ({+ template: `+ <div class="grid grid-cols-2 gap-4">+ <VContentLink+ v-for="(type, key) in types"+ :key="key"+ :media-type="type.mediaType"+ :results-count="type.resultsCount"+ :is-selected="selected == type.mediaType"+ @click="onSelected(type.mediaType)"/>+ </div>+ `,+ components: { VContentLink },+ data() {+ return {+ types: [+ { mediaType: 'image', resultsCount: 4321 },+ { mediaType: 'audio', resultsCount: 1234 },+ ],+ selected: 'audio',+ }+ },+ methods: {+ onSelected(mediaType) {+ this.selected = mediaType+ },+ },+})++export const Default = VContentLinkStory.bind({})+Default.args = {+ mediaType: 'image',+ resultsCount: 5708,+ isSelected: false,+}++const VContentLinkHorizontalStory = (args, { argTypes }) => ({+ template: `<div class="max-w-md"><VContentLink v-bind="$props" /></div>`,+ components: { VContentLink },+ props: Object.keys(argTypes),+})++export const Horizontal = VContentLinkHorizontalStory.bind({})+Horizontal.args = {+ mediaType: 'audio',+ resultsCount: 4561,+ isSelected: false,+ layout: 'horizontal',+}++export const Mobile = TwoVContentLinkStory.bind({})+Mobile.parameters = {+ viewport: { defaultViewport: 'mob' },+}diff --git a/src/components/Filters/FilterChecklist.vue b/src/components/VFilters/VFilterChecklist.vuesimilarity index 95%rename from src/components/Filters/FilterChecklist.vuerename to src/components/VFilters/VFilterChecklist.vueindex bca060783..d7eafaff0 100644--- a/src/components/Filters/FilterChecklist.vue+++ b/src/components/VFilters/VFilterChecklist.vue@@ -47,7 +47,7 @@</svg></button></div>- <LicenseExplanationTooltip+ <VLicenseExplanationTooltipv-if="licenseExplanationVisible":license="licenseExplanationCode":icon-dom-node="$refs[`${licenseExplanationCode}licenseIcon`][0]"@@ -56,14 +56,16 @@</template><script>-import LicenseExplanationTooltip from '~/components/Filters/LicenseExplanationTooltip'+import VLicenseExplanationTooltip from '~/components/VFilters/VLicenseExplanationTooltip'+import VCheckbox from '~/components/VCheckbox.vue'import VLicense from '~/components/License/VLicense.vue'export default {name: 'FilterCheckList',components: {+ VCheckbox,VLicense,- LicenseExplanationTooltip,+ VLicenseExplanationTooltip,},props: {options: { type: Array, required: false },diff --git a/src/components/Filters/FilterDisplay.vue b/src/components/VFilters/VFilterDisplay.vuesimilarity index 89%rename from src/components/Filters/FilterDisplay.vuerename to src/components/VFilters/VFilterDisplay.vueindex ab2eacaa8..f6381c31d 100644--- a/src/components/Filters/FilterDisplay.vue+++ b/src/components/VFilters/VFilterDisplay.vue@@ -3,7 +3,7 @@<span v-if="isAnyFilterApplied" class="me-2 font-semibold mb-2">{{ $t('filters.filter-by') }}</span>- <FilterTag+ <VFilterTagv-for="filter in appliedFilterTags":key="filter.code"class="mx-1 mb-2 ms-2"@@ -16,14 +16,15 @@</template><script>-import { TOGGLE_FILTER } from '~/constants/action-types'-import FilterTag from '~/components/Filters/FilterTag'import { mapGetters } from 'vuex'+import { TOGGLE_FILTER } from '~/constants/action-types'import { SEARCH } from '~/constants/store-modules'+import VFilterTag from '~/components/VFilters/VFilterTag'+export default {name: 'FilterDisplay',- components: { FilterTag },+ components: { VFilterTag },computed: {...mapGetters(SEARCH, ['appliedFilterTags', 'isAnyFilterApplied']),},diff --git a/src/components/Filters/FilterTag.vue b/src/components/VFilters/VFilterTag.vuesimilarity index 97%rename from src/components/Filters/FilterTag.vuerename to src/components/VFilters/VFilterTag.vueindex 817074d14..4b0ca1779 100644--- a/src/components/Filters/FilterTag.vue+++ b/src/components/VFilters/VFilterTag.vue@@ -10,7 +10,7 @@</template><script>export default {- name: 'FilterTag',+ name: 'VFilterTag',props: {code: String,filterType: String,diff --git a/src/components/Filters/LicenseExplanationTooltip.vue b/src/components/VFilters/VLicenseExplanationTooltip.vuesimilarity index 99%rename from src/components/Filters/LicenseExplanationTooltip.vuerename to src/components/VFilters/VLicenseExplanationTooltip.vueindex 833e15b21..e1f0b7086 100644--- a/src/components/Filters/LicenseExplanationTooltip.vue+++ b/src/components/VFilters/VLicenseExplanationTooltip.vue@@ -40,7 +40,7 @@import { isLicense } from '~/utils/license'export default {- name: 'LicenseExplanationTooltip',+ name: 'VLicenseExplanationTooltip',props: {license: {diff --git a/src/components/Filters/SearchGridFilter.vue b/src/components/VFilters/VSearchGridFilter.vuesimilarity index 82%rename from src/components/Filters/SearchGridFilter.vuerename to src/components/VFilters/VSearchGridFilter.vueindex 4a63e9f0b..68ddd33ec 100644--- a/src/components/Filters/SearchGridFilter.vue+++ b/src/components/VFilters/VSearchGridFilter.vue@@ -1,7 +1,6 @@<template><div- class="p-4 search-filters h-auto max-h-full overflow-y-scroll"- :class="[isFilterVisible ? 'block' : 'hidden']"+ class="p-4 search-filters h-auto max-h-full overflow-y-scroll block"data-testid="filters-list"@onUpdateFilter="onUpdateFilter"@onToggleSearchGridFilter="onToggleSearchGridFilter"@@ -14,19 +13,20 @@<buttonid="hide-filters-button"type="button"+ :aria-label="$t('filter-list.hide')"class="text-sm font-medium my-auto"@click="onToggleSearchGridFilter">- <span class="text-trans-blue hidden lg:block text-sm lowercase">{{+ <span class="text-trans-blue hidden md:block text-sm lowercase">{{$t('filter-list.hide')}}</span>- <span class="me-4 text-lg lg:hidden">+ <span class="me-4 text-lg md:hidden"><CloseIcon class="w-4 h-4" /></span></button></div><form class="filters-form">- <FilterChecklist+ <VFilterChecklistv-for="filterType in filterTypes":key="filterType":options="filters[filterType]"@@ -56,22 +56,21 @@</template><script>-import { mapActions, mapGetters, mapMutations, mapState } from 'vuex'-import { SET_FILTER_IS_VISIBLE } from '~/constants/mutation-types'+import { mapActions, mapGetters } from 'vuex'import { CLEAR_FILTERS, TOGGLE_FILTER } from '~/constants/action-types'import { SEARCH } from '~/constants/store-modules'import { kebabize } from '~/utils/format-strings'-import FilterChecklist from '~/components/Filters/FilterChecklist'++import VFilterChecklist from '~/components/VFilters/VFilterChecklist'import CloseIcon from '~/assets/icons/close.svg?inline'export default {- name: 'SearchGridFilter',+ name: 'VSearchGridFilter',components: {CloseIcon,- FilterChecklist,+ VFilterChecklist,},computed: {- ...mapState(SEARCH, ['isFilterVisible']),...mapGetters(SEARCH, ['mediaFiltersForDisplay', 'isAnyFilterApplied']),filters() {return this.mediaFiltersForDisplay || {}@@ -85,9 +84,6 @@ export default {toggleFilter: TOGGLE_FILTER,clearFilters: CLEAR_FILTERS,}),- ...mapMutations(SEARCH, {- setFilterVisible: SET_FILTER_IS_VISIBLE,- }),filterTypeTitle(filterType) {if (filterType === 'searchBy') {return ''@@ -101,9 +97,7 @@ export default {this.clearFilters()},onToggleSearchGridFilter() {- this.setFilterVisible({- isFilterVisible: !this.isFilterVisible,- })+ this.$emit('close')},},}diff --git a/src/components/VHeader/README.md b/src/components/VHeader/README.mdnew file mode 100644index 000000000..07a73b030--- /dev/null+++ b/src/components/VHeader/README.md@@ -0,0 +1,13 @@+# VHeader++The sticky header at the top of the page. On the homepage and the content pages, it shows one version, and on the Search page it additionally has a Content Switcher, collapsed menu for page links, and a filters button. On mobile, the header only shows the logo and close button when the overlay/flyout menu (containing pages, the content switcher, and filters) is open.++## Components++### VLogoLoader++- TBD++### VFilterButton++This button toggles the filter drawer on desktop. On mobile, it opens the mobile drawer menu, set to the filters pane.diff --git a/src/components/VHeader/VFilterButton.vue b/src/components/VHeader/VFilterButton.vuenew file mode 100644index 000000000..16cafba99--- /dev/null+++ b/src/components/VHeader/VFilterButton.vue@@ -0,0 +1,129 @@+<template>+ <VButton+ :variant="variant"+ class="self-center gap-2 align-center font-semibold"+ :pressed="pressed"+ aria-controls="filter-sidebar"+ :aria-label="label"+ @click="toggleFilters"+ >+ <VIcon v-if="showIcon" :icon-path="filterIcon" />+ <span v-if="showLabel" data-testid="filterbutton-label">{{ label }}</span>+ </VButton>+</template>++<script>+import {+ computed,+ defineComponent,+ toRefs,+ useContext,+} from '@nuxtjs/composition-api'+import { isMinScreen } from '~/composables/use-media-query'+import filterIcon from '~/assets/icons/filter.svg'+import VButton from '~/components/VButton.vue'+import VIcon from '~/components/VIcon/VIcon'++const VFilterButton = defineComponent({+ name: 'VFilterButton',+ components: {+ VIcon,+ VButton,+ },+ props: {+ /**+ * @default false+ */+ isHeaderScrolled: {+ type: Boolean,+ default: false,+ },+ pressed: {+ type: Boolean,+ default: false,+ },+ },+ setup(props, { emit }) {+ const { i18n, store } = useContext()+ const { isHeaderScrolled, pressed } = toRefs(props)+ const isMinScreenMD = isMinScreen('md')++ const filterCount = computed(+ () => store.getters['search/appliedFilterTags'].length+ )+ const filtersAreApplied = computed(() => filterCount.value > 0)++ /**+ * Determine the visual style of the button+ * based on the viewport, the application of filters, and scrolling.+ */+ const variant = computed(() => {+ // Show the borderd state by default, unless below md+ let value = isMinScreenMD.value ? 'action-menu' : 'action-menu-secondary'++ if (isHeaderScrolled.value) {+ value = 'action-menu-secondary'+ }+ if (filtersAreApplied.value) {+ value = 'action-menu-muted'+ }+ // Override the default VButton pressed style+ if (pressed.value) {+ value = 'action-menu-muted-pressed'+ }+ return value+ })++ const label = computed(() => {+ // Below medium viewport logic+ if (!isMinScreenMD.value) {+ return isHeaderScrolled.value+ ? filterCount.value+ : i18n.tc('header.filter-button.with-count', filterCount.value)+ }+ // Above the medium viewport, show the count when filters are applied.+ return filtersAreApplied.value+ ? i18n.tc('header.filter-button.with-count', filterCount.value)+ : i18n.t('header.filter-button.simple')+ })++ /**+ * Whether or not to show the filter icon,+ * based on viewport and the application of filters.+ */+ const showIcon = computed(() => {+ // When filters are applied, hide the icon+ if (filtersAreApplied.value) {+ return false+ }+ // Below the medium viewport, only show when there's no filters applied.+ if (!isMinScreenMD.value) {+ return !isHeaderScrolled.value || !filtersAreApplied.value+ }+ return true+ })++ // Hide the label entirely when no filters are applied on mobile.+ const showLabel = computed(() => {+ if (!isMinScreenMD.value && !filtersAreApplied.value) {+ return false+ }+ return true+ })++ return {+ filterCount,+ filterIcon,+ label,+ showIcon,+ showLabel,+ toggleFilters: () => {+ emit('toggle')+ },+ variant,+ }+ },+})++export default VFilterButton+</script>diff --git a/src/components/VHeader/VHeader.vue b/src/components/VHeader/VHeader.vuenew file mode 100644index 000000000..b9486de94--- /dev/null+++ b/src/components/VHeader/VHeader.vue@@ -0,0 +1,225 @@+<template>+ <header+ class="sticky top-0 flex py-4 px-4 md:px-7 items-center justify-between z-40 w-full bg-white gap-x-2"+ :class="{+ 'border-b border-white': !isHeaderScrolled && !isFilterSidebarVisible,+ 'border-b border-dark-charcoal-20':+ isSearchRoute && (isHeaderScrolled || isFilterSidebarVisible),+ 'flex-wrap gap-y-4': !isMinScreenMD && !isHeaderScrolled,+ }"+ >+ <NuxtLink+ to="/"+ class="rounded-sm ring-offset-1 focus:outline-none focus-visible:ring focus-visible:ring-pink -ms-2 inline-flex items-center hover:bg-yellow"+ :class="{+ 'pe-3': !isHeaderScrolled || !isSearchRoute,+ 'md:px-0': isSearchRoute,+ }"+ >+ <VLogoLoader :status="isFetching ? 'loading' : 'idle'" />+ <OpenverseLogoText+ v-if="!isHeaderScrolled"+ class="-ml-1 mt-1"+ :class="{ 'md:hidden': isSearchRoute }"+ width="95"+ height="15"+ />+ </NuxtLink>++ <VSearchBar+ v-show="!isHomeRoute"+ v-model.trim="searchTerm"+ class="mx-auto md:ms-0 md:me-auto lg:w-1/2 2xl:w-1/3"+ :class="{+ 'order-4 w-full md:order-none md:w-auto': !isHeaderScrolled,+ 'w-2/3': isHeaderScrolled,+ }"+ @submit="handleSearch"+ >+ <span+ v-if="searchStatus"+ class="info font-semibold text-xs text-dark-charcoal-70 group-hover:text-dark-charcoal group-focus:text-dark-charcoal mx-4"+ >+ {{ searchStatus }}+ </span>+ </VSearchBar>++ <VFilterButton+ v-if="isSearchRoute"+ :is-header-scrolled="isHeaderScrolled"+ :pressed="isFilterSidebarVisible"+ @toggle="toggleFilterVisibility"+ />+ </header>+</template>++<script>+import OpenverseLogoText from '~/assets/icons/openverse-logo-text.svg?inline'+import {+ computed,+ defineComponent,+ ref,+ useContext,+ useRouter,+ watch,+ watchEffect,+} from '@nuxtjs/composition-api'++import { MEDIA, SEARCH } from '~/constants/store-modules'+import { FETCH_MEDIA, UPDATE_QUERY } from '~/constants/action-types'+import { AUDIO, IMAGE } from '~/constants/media'+import { isMinScreen } from '~/composables/use-media-query'+import {+ useMatchSearchRoutes,+ useMatchHomeRoute,+} from '~/composables/use-match-routes'+import { useWindowScroll } from '~/composables/use-window-scroll'+import { useFilterSidebarVisibility } from '~/composables/use-filter-sidebar-visibility'++import closeIcon from '~/assets/icons/close.svg'++import VSearchBar from '~/components/VHeader/VSearchBar/VSearchBar'+import VFilterButton from '~/components/VHeader/VFilterButton'+import VLogoLoader from '~/components/VLogoLoader/VLogoLoader'++const i18nKeys = {+ [AUDIO]: {+ noResult: 'browse-page.audio-no-results',+ result: 'browse-page.audio-result-count',+ more: 'browse-page.audio-result-count-more',+ },+ [IMAGE]: {+ noResult: 'browse-page.image-no-results',+ result: 'browse-page.image-result-count',+ more: 'browse-page.image-result-count-more',+ },+}++const VHeader = defineComponent({+ name: 'VHeader',+ components: {+ VFilterButton,+ VLogoLoader,+ VSearchBar,+ OpenverseLogoText,+ },+ setup() {+ const { app, i18n, store } = useContext()+ const { matches: isSearchRoute } = useMatchSearchRoutes()+ const { matches: isHomeRoute } = useMatchHomeRoute()+ const { isHeaderScrolled } = useWindowScroll()+ const router = useRouter()+ const isMinScreenMD = isMinScreen('md', { shouldPassInSSR: true })+ const { isFilterSidebarVisible, setFilterSidebarVisibility } =+ useFilterSidebarVisibility({ mediaQuery: isMinScreenMD })++ /**+ * Return a text representation of the result count.+ * @param {number} count+ * @returns {string}+ */+ const mediaCount = (count) => {+ if (store.getters['media/unsupportedMediaType']) return ''++ const countKey =+ count === 0 ? 'noResult' : count >= 10000 ? 'more' : 'result'+ const i18nKey = i18nKeys[store.state.search.query.mediaType][countKey]+ const localeCount = count.toLocaleString(i18n.locale)+ return i18n.tc(i18nKey, count, { localeCount })+ }++ /** @type {import('@nuxtjs/composition-api').ComputedRef<number>} */+ const resultsCount = computed(+ () => store.getters['media/results']?.count ?? 0+ )++ /** @type {import('@nuxtjs/composition-api').ComputedRef<boolean>} */+ const isFetching = computed(() => {+ return store.getters['media/fetchState'].isFetching+ })++ /**+ * Status is hidden below the medium breakpoint.+ * It shows Loading... or Number of results on bigger screens.+ * @returns {string}+ */+ const setInitialStatus = () => {+ if (!isMinScreenMD.value) return ''+ if (isFetching.value) return i18n.t('header.loading')+ return store.state.search.query.q === ''+ ? ''+ : mediaCount(resultsCount.value)+ }++ /** @type {import('@nuxtjs/composition-api').Ref<string>} */+ const searchStatus = ref(setInitialStatus())++ watchEffect(() => {+ if (isMinScreenMD.value) {+ searchStatus.value = isFetching.value+ ? i18n.t('header.loading')+ : mediaCount(resultsCount.value)+ } else {+ searchStatus.value = ''+ }+ })++ const localSearchTerm = ref(store.state.search.query.q)+ const searchTerm = computed({+ get: () => localSearchTerm.value,+ set: async (value) => {+ localSearchTerm.value = value+ },+ })++ watch(+ () => store.state.search.query.q,+ (newSearchTerm) => {+ if (newSearchTerm !== localSearchTerm.value) {+ localSearchTerm.value = newSearchTerm+ }+ }+ )++ const handleSearch = async () => {+ // Don't do anything if search term hasn't changed+ if (localSearchTerm.value === store.state.search.query.q) return++ await store.dispatch(`${SEARCH}/${UPDATE_QUERY}`, {+ q: localSearchTerm.value,+ })++ const searchType = store.state.search.searchType+ const newPath = app.localePath({+ path: `/search/${searchType === 'all' ? '' : searchType}`,+ query: store.getters['search/searchQueryParams'],+ })+ router.push(newPath)++ await store.dispatch(`${MEDIA}/${FETCH_MEDIA}`, {+ ...store.getters['search/searchQueryParams'],+ })+ }++ const toggleFilterVisibility = () => {+ setFilterSidebarVisibility(!isFilterSidebarVisible.value)+ }++ return {+ closeIcon,+ handleSearch,+ isFetching,+ isFilterSidebarVisible,+ isHeaderScrolled,+ isMinScreenMD,+ isSearchRoute,+ isHomeRoute,+ searchStatus,+ searchTerm,+ toggleFilterVisibility,+ }+ },+})++export default VHeader+</script>diff --git a/src/components/Header/SearchBar/SearchBar.vue b/src/components/VHeader/VSearchBar/VSearchBar.vuesimilarity index 57%rename from src/components/Header/SearchBar/SearchBar.vuerename to src/components/VHeader/VSearchBar/VSearchBar.vueindex fd9b7044c..4e9d6f69d 100644--- a/src/components/Header/SearchBar/SearchBar.vue+++ b/src/components/VHeader/VSearchBar/VSearchBar.vue@@ -1,43 +1,44 @@<template>- <form class="search-bar group flex flex-row" @submit.prevent="handleSearch">- <InputField- v-model="text"+ <form+ class="search-bar group flex flex-row items-center bg-white rounded-sm"+ @submit.prevent="handleSearch"+ >+ <VInputFieldv-bind="$attrs"class="flex-grow search-field"+ label-text="Search":connection-sides="['end']"- input-id="search-bar"+ field-id="search-bar"type="search"name="q"+ :model-value="searchText"+ @update:modelValue="updateSearchText"><!-- @slot Extra information such as loading message or result count goes here. --><slot />- </InputField>- <SearchButton type="submit" />+ </VInputField>+ <VSearchButton type="submit" /></form></template><script>-import { computed } from '@nuxtjs/composition-api'+import { computed, defineComponent } from '@nuxtjs/composition-api'-import InputField from '~/components/InputField/InputField.vue'-import SearchButton from '~/components/Header/SearchBar/SearchButton.vue'+import VInputField from '~/components/VInputField/VInputField.vue'+import VSearchButton from '~/components/VHeader/VSearchBar/VSearchButton.vue'/*** Displays a text field for a search query and is attached to an action button* that fires a search request. The loading state and number of hits are also* displayed in the bar itself.*/-export default {- name: 'SearchBar',+const VSearchBar = defineComponent({+ name: 'VSearchBar',components: {- InputField,- SearchButton,+ VInputField,+ VSearchButton,},inheritAttrs: false,- model: {- prop: 'value',- event: 'input',- },props: {/*** the search query given as input to the field@@ -47,27 +48,25 @@ export default {default: '',},},+ emits: ['input', 'submit'],setup(props, { emit }) {- const text = computed({- get() {- return props.value- },- set(value) {- emit('input', value)- },- })+ const searchText = computed(() => props.value)+ const updateSearchText = (val) => {+ emit('input', val)+ }const handleSearch = () => {emit('submit')}return {- text,-handleSearch,+ searchText,+ updateSearchText,}},-}+})+export default VSearchBar</script><style>diff --git a/src/components/VHeader/VSearchBar/VSearchButton.vue b/src/components/VHeader/VSearchBar/VSearchButton.vuenew file mode 100644index 000000000..9107e277d--- /dev/null+++ b/src/components/VHeader/VSearchBar/VSearchButton.vue@@ -0,0 +1,40 @@+<template>+ <VIconButton+ v-bind="$attrs"+ size="search"+ class="search-button hover:text-white group-hover:text-white hover:bg-pink group-hover:bg-pink p-0.5px ps-1.5px focus:p-0 border md:border border-dark-charcoal-20 hover:border-pink group-hover:border-pink rounded-e-sm active:shadow-ring"+ :icon-props="{ iconPath: searchIcon }"+ :aria-label="$t('search.search')"+ v-on="$listeners"+ />+</template>++<script>+import VIconButton from '~/components/VIconButton/VIconButton.vue'++import searchIcon from '~/assets/icons/search.svg'++export default {+ name: 'VSearchButton',+ components: { VIconButton },+ inheritAttrs: false,+ setup() {+ return { searchIcon }+ },+}+</script>++<style>+/* @todo: Find a better way to override the VIconButton border styles */+.search-button {+ /* Negative margin removes a tiny gap between the button and the input borders */+ margin-inline-start: -1px;+ border-inline-start-color: transparent;+}+.search-button.search-button:not(:hover):not(:focus):not(:focus-within) {+ border-inline-start-color: transparent;+}+.search-button.search-button:hover {+ border-inline-start-color: rgba(214, 212, 213, 1);+}+</style>diff --git a/src/components/Header/SearchBar/meta/SearchBar.stories.mdx b/src/components/VHeader/VSearchBar/meta/VSearchBar.stories.mdxsimilarity index 76%rename from src/components/Header/SearchBar/meta/SearchBar.stories.mdxrename to src/components/VHeader/VSearchBar/meta/VSearchBar.stories.mdxindex 1851645ad..403c4964e 100644--- a/src/components/Header/SearchBar/meta/SearchBar.stories.mdx+++ b/src/components/VHeader/VSearchBar/meta/VSearchBar.stories.mdx@@ -5,11 +5,11 @@ import {Meta,Story,} from '@storybook/addon-docs'-import SearchBar from '~/components/Header/SearchBar/SearchBar.vue'+import VSearchBar from '~/components/VHeader/VSearchBar/VSearchBar.vue'<Metatitle="Components/Header/Search bar"- component={SearchBar}+ component={VSearchBar}argTypes={{input: {action: 'input',@@ -22,18 +22,18 @@ import SearchBar from '~/components/Header/SearchBar/SearchBar.vue'export const Template = (args, { argTypes }) => ({template: `- <SearchBar v-bind="$props" v-on="$props">+ <VSearchBar v-bind="$props" v-on="$props">12,345 results- </SearchBar>`,- components: { SearchBar },+ </VSearchBar>`,+ components: { VSearchBar },props: Object.keys(argTypes),})# Search bar-<Description of={SearchBar} />+<Description of={VSearchBar} />-<ArgsTable of={SearchBar} />+<ArgsTable of={VSearchBar} />The component emits an `input` event with the new contents of the field wheneverthe field receives an input. It also emits the `search` event when the search@@ -56,13 +56,13 @@ representing the search query.export const vModelTemplate = () => ({template: `<div>- <SearchBar v-model="text">+ <VSearchBar v-model="text">{{ text.length }}- </SearchBar>+ </VSearchBar>{{ text }}</div>`,- components: { SearchBar },+ components: { VSearchBar },data() {return {text: 'Hello, World!',@@ -74,7 +74,7 @@ export const vModelTemplate = () => ({<Story name="v-model">{vModelTemplate.bind({})}</Story></Canvas>-The `SearchBar` component passes all attributes down to the inner `InputField`+The `VSearchBar` component passes all attributes down to the inner `InputField`which itself applies all its attributes to its inner `<input>` element. So it'seasy `<input>` attributes like placeholders or HTML validations.diff --git a/src/components/VHeader/meta/VFilterButton.stories.mdx b/src/components/VHeader/meta/VFilterButton.stories.mdxnew file mode 100644index 000000000..30d23ab0b--- /dev/null+++ b/src/components/VHeader/meta/VFilterButton.stories.mdx@@ -0,0 +1,72 @@+import {+ ArgsTable,+ Canvas,+ Description,+ Meta,+ Story,+} from '@storybook/addon-docs'+import VFilterButton from '~/components/VHeader/VFilterButton.vue'+import Vuex from 'vuex'++<Meta+ title="Components/VHeader/VFilterButton"+ component={VFilterButton}+ argTypes={{+ input: {+ action: 'input',+ },+ submit: {+ action: 'submit',+ },+ }}+/>++export const Template = (args, { argTypes }) => ({+ template: `+ <VFilterButton v-bind="$props" v-on="$props" />`,+ components: { VFilterButton },+ props: Object.keys(argTypes),+ store: new Vuex.Store({+ getters: {+ 'search/appliedFilterTags': () => [{ code: 'by', filterType: 'license' }],+ },+ }),+})++# Filter button++<Description of={VFilterButton} />++<ArgsTable of={VFilterButton} />++The button opens and closes the filters sidebar. It also shows how many filters are applied+in the mobile view.+the field receives an input. It also emits the `search` event when the search+button is clicked.++<Canvas>+ <Story+ name="Default"+ args={{+ value: 'Search query',+ }}+ >+ {Template.bind({})}+ </Story>+</Canvas>++<Canvas>+ <Story+ name="Mobile Scrolled"+ args={{+ isScrolled: true,+ }}+ parameters={{+ viewport: {+ defaultViewport: 'iphonex',+ },+ }}+ >+ {Template.bind({})}+ </Story>+</Canvas>diff --git a/src/components/VHeader/meta/VHeader.stories.mdx b/src/components/VHeader/meta/VHeader.stories.mdxnew file mode 100644index 000000000..0644acf8f--- /dev/null+++ b/src/components/VHeader/meta/VHeader.stories.mdx@@ -0,0 +1,40 @@+import {+ ArgsTable,+ Canvas,+ Description,+ Meta,+ Story,+} from '@storybook/addon-docs'+import VHeader from '~/components/VHeader/VHeader.vue'++<Meta+ title="Components/VHeader/VHeader"+ component={VHeader}+ argTypes={{+ input: {+ action: 'input',+ },+ submit: {+ action: 'submit',+ },+ }}+/>++export const Template = (args, { argTypes }) => ({+ template: `+ <VHeader v-bind="$props" v-on="$props" />`,+ components: { VHeader },+ props: Object.keys(argTypes),+})++# VHeader++<Description of={VHeader} />++<ArgsTable of={VHeader} />++The header component. Fixed on scroll, search bar, content switcher, pages menu and filters button.++<Canvas>+ <Story name="Default">{Template.bind({})}</Story>+</Canvas>diff --git a/src/components/VHeader/meta/VSearchBar.stories.mdx b/src/components/VHeader/meta/VSearchBar.stories.mdxnew file mode 100644index 000000000..dc871a271--- /dev/null+++ b/src/components/VHeader/meta/VSearchBar.stories.mdx@@ -0,0 +1,90 @@+import {+ ArgsTable,+ Canvas,+ Description,+ Meta,+ Story,+} from '@storybook/addon-docs'+import VSearchBar from '~/components/VHeader/VSearchBar/VSearchBar.vue'++<Meta+ title="Components/Header/Search bar"+ component={VSearchBar}+ argTypes={{+ input: {+ action: 'input',+ },+ submit: {+ action: 'submit',+ },+ }}+/>++export const Template = (args, { argTypes }) => ({+ template: `+ <VSearchBar v-bind="$props" v-on="$props">+ 12,345 results+ </VSearchBar>`,+ components: { VSearchBar },+ props: Object.keys(argTypes),+})++# Search bar++<Description of={VSearchBar} />++<ArgsTable of={VSearchBar} />++The component emits an `input` event with the new contents of the field whenever+the field receives an input. It also emits the `submit` event when the search+button is clicked.++<Canvas>+ <Story+ name="Default"+ args={{+ value: 'Search query',+ }}+ >+ {Template.bind({})}+ </Story>+</Canvas>++The recommended way to use it is with `v-model` mapping to a `String`+representing the search query.++export const vModelTemplate = () => ({+ template: `+ <div>+ <VSearchBar v-model="text">+ {{ text.length }}+ </VSearchBar>+ {{ text }}+ </div>+ `,+ components: { VSearchBar },+ data() {+ return {+ text: 'Hello, World!',+ }+ },+})++<Canvas>+ <Story name="v-model">{vModelTemplate.bind({})}</Story>+</Canvas>++The `VSearchBar` component passes all attributes down to the inner `InputField`+which itself applies all its attributes to its inner `<input>` element. So it's+easy `<input>` attributes like placeholders or HTML validations.++<Canvas>+ <Story+ name="With placeholder"+ args={{+ placeholder: 'Search query',+ }}+ >+ {Template.bind({})}+ </Story>+</Canvas>diff --git a/src/components/VImageGrid/VImageCell.vue b/src/components/VImageGrid/VImageCell.vuenew file mode 100644index 000000000..2036bc271--- /dev/null+++ b/src/components/VImageGrid/VImageCell.vue@@ -0,0 +1,92 @@+<template>+ <NuxtLink+ v-slot="{ href }"+ itemprop="contentUrl"+ :to="localePath('/image/' + image.id)"+ :title="image.title"+ custom+ >+ <a+ :href="href"+ class="group relative focus:outline-none focus-visible:ring focus-visible:ring-offset-2 focus-visible:ring-pink"+ @click="onGotoDetailPage($event, image)"+ @keydown.tab.prevent="onFocusLeave"+ >+ <figure+ itemprop="image"+ itemscope=""+ itemtype="https://schema.org/ImageObject"+ >+ <img+ ref="img"+ loading="lazy"+ :alt="image.title"+ :src="getImageUrl(image)"+ :width="image.width"+ :height="image.height"+ itemprop="thumbnailUrl"+ @error="onImageLoadError($event, image)"+ />+ <figcaption+ class="absolute left-0 bottom-0 invisible group-hover:visible group-focus:visible bg-white p-1"+ >+ <span class="sr-only">{{ image.title }}</span>+ <VLicense+ :license="image.license"+ :bg-filled="true"+ :hide-name="true"+ />+ </figcaption>+ </figure>+ </a>+ </NuxtLink>+</template>++<script>+import VLicense from '~/components/License/VLicense.vue'+const errorImage = require('~/assets/image_not_available_placeholder.png')++const toAbsolutePath = (url, prefix = 'https://') => {+ if (url.indexOf('http://') >= 0 || url.indexOf('https://') >= 0) {+ return url+ }+ return `${prefix}${url}`+}++export default {+ name: 'ImageCell',+ components: { VLicense },+ props: ['image'],+ methods: {+ getImageUrl(image) {+ if (!image) return ''+ const url = image.thumbnail || image.url+ return toAbsolutePath(url)+ },+ getImageForeignUrl(image) {+ return toAbsolutePath(image.foreign_landing_url)+ },+ onGotoDetailPage(event, image) {+ if (!event.metaKey && !event.ctrlKey) {+ event.preventDefault()+ const detailRoute = this.localeRoute({+ name: 'PhotoDetailPage',+ params: { id: image.id, location: window.scrollY },+ })+ this.$router.push(detailRoute)+ }+ },+ onImageLoadError(event, image) {+ const element = event.target+ if (element.src !== image.url) {+ element.src = image.url+ } else {+ element.src = errorImage+ }+ },+ onFocusLeave(event) {+ this.$emit('focus-leave', event)+ },+ },+}+</script>diff --git a/src/components/InputField/InputField.vue b/src/components/VInputField/VInputField.vuesimilarity index 62%rename from src/components/InputField/InputField.vuerename to src/components/VInputField/VInputField.vueindex 21b574e46..96e1cc64c 100644--- a/src/components/InputField/InputField.vue+++ b/src/components/VInputField/VInputField.vue@@ -1,6 +1,6 @@<template><div- class="input-field group flex flex-row items-center gap-4 hover:bg-dark-charcoal-06 focus-within:bg-dark-charcoal-06 group-hover:bg-dark-charcoal-06 h-12 p-0.5px focus-within:p-0 border focus-within:border-1.5 border-dark-charcoal-20 rounded-sm overflow-hidden focus-within:border-pink"+ class="input-field group flex flex-row items-center hover:bg-dark-charcoal-06 focus-within:bg-dark-charcoal-06 group-hover:bg-dark-charcoal-06 h-12 p-0.5px focus-within:p-0 border focus-within:border-1.5 border-dark-charcoal-20 rounded-sm overflow-hidden focus-within:border-pink":class="[{// Padding is set to 1.5px to accommodate the border that will appear later.@@ -12,39 +12,35 @@<label class="sr-only" :for="fieldId">{{ labelText }}</label><input:id="fieldId"- v-model="text"v-bind="$attrs":type="type"- class="flex-grow leading-none font-semibold bg-tx placeholder-dark-charcoal-70 ms-4 h-full focus:outline-none"+ class="flex-1 leading-none font-semibold bg-tx placeholder-dark-charcoal-70 ms-4 h-full focus:outline-none"+ :value="modelValue"+ @input="updateModelValue"v-on="$listeners"/>- <div- class="info font-semibold text-xs text-dark-charcoal-70 group-hover:text-dark-charcoal group-focus:text-dark-charcoal me-4"- >- <!-- @slot Extra information goes here -->- <slot />- </div>++ <!-- @slot Extra information goes here -->+ <slot /></div></template><script>-import { computed } from '@nuxtjs/composition-api'-/*** Provides a control to enter text as input.*/export default {- name: 'InputField',+ name: 'VInputField',inheritAttrs: false,model: {- prop: 'value',- event: 'input',+ prop: 'modelValue',+ event: 'update:modelValue',},props: {/*** the textual content of the input field*/- value: {+ modelValue: {type: String,default: '',},@@ -73,22 +69,20 @@ export default {validator: (val) => val.every((item) => ['start', 'end'].includes(item)),},},+ // using non-native event name to ensure the two are not mixed+ emits: ['update:modelValue'],setup(props, { emit, attrs }) {const type = attrs['type'] ?? 'text'- const text = computed({- get() {- return props.value- },- set(value) {- emit('input', value)- },- })+ const updateModelValue = (event) => {+ emit('update:modelValue', event.target.value)+ }return {+ emit,type,- text,+ updateModelValue,}},}@@ -98,4 +92,8 @@ export default {.input-field:focus-within .info {@apply text-dark-charcoal;}++.input-field input::placeholder {+ font-weight: normal;+}</style>diff --git a/src/components/InputField/meta/InputField.stories.mdx b/src/components/VInputField/meta/VInputField.stories.mdxsimilarity index 82%rename from src/components/InputField/meta/InputField.stories.mdxrename to src/components/VInputField/meta/VInputField.stories.mdxindex 3c893541f..829b38f3e 100644--- a/src/components/InputField/meta/InputField.stories.mdx+++ b/src/components/VInputField/meta/VInputField.stories.mdx@@ -6,33 +6,33 @@ import {Story,} from '@storybook/addon-docs'-import InputField from '~/components/InputField/InputField.vue'+import VInputField from '~/components/VInputField/VInputField.vue'<Meta- title="Components/Input field"- component={InputField}+ title="Components/VInputField"+ component={VInputField}argTypes={{- input: {- action: 'input',+ 'update:modelValue': {+ action: 'update:modelValue',},}}/>export const Template = (args, { argTypes }) => ({template: `- <InputField v-bind="$props" v-on="$props">+ <VInputField v-bind="$props" v-on="$props">Extra info- </InputField>+ </VInputField>`,- components: { InputField },+ components: { VInputField },props: Object.keys(argTypes),})# Input field-<Description of={InputField} />+<Description of={VInputField} />-<ArgsTable of={InputField} />+<ArgsTable of={VInputField} />The component emits an `input` event with the new contents of the field wheneverthe field receives an input.@@ -53,13 +53,13 @@ The recommended way to use it is with `v-model` mapping to a `String`.export const vModelTemplate = () => ({template: `<div>- <InputField v-model="text">+ <VInputField v-model="text">{{ text.length }}- </InputField>+ </VInputField>{{ text }}</div>`,- components: { InputField },+ components: { VInputField },data() {return {text: 'Hello, World!',@@ -110,10 +110,10 @@ export const labelTemplate = () => ({template: `<div><label for="field">Label:</label>- <InputField id="field"/>+ <VInputField id="field"/></div>`,- components: { InputField },+ components: { VInputField },})<Canvas>diff --git a/src/components/VLoadMore.vue b/src/components/VLoadMore.vuenew file mode 100644index 000000000..eea604042--- /dev/null+++ b/src/components/VLoadMore.vue@@ -0,0 +1,39 @@+<template>+ <VButton+ size="large"+ variant="full"+ type="button"+ :disabled="isFetching"+ @click="onLoadMore"+ >+ {{ buttonLabel }}+ </VButton>+</template>+<script>+import { computed, defineComponent, useContext } from '@nuxtjs/composition-api'+export default defineComponent({+ name: 'VLoadMore',+ props: {+ isFetching: {+ type: Boolean,+ default: true,+ },+ },+ setup(props, { emit }) {+ const { i18n } = useContext()++ const buttonLabel = computed(() => {+ return i18n.t('browse-page.load')+ })++ const onLoadMore = () => {+ emit('onLoadMore')+ }++ return {+ buttonLabel,+ onLoadMore,+ }+ },+})+</script>diff --git a/src/components/VLogoLoader/VLogoLoader.vue b/src/components/VLogoLoader/VLogoLoader.vueindex ce4ddac14..790dd4d52 100644--- a/src/components/VLogoLoader/VLogoLoader.vue+++ b/src/components/VLogoLoader/VLogoLoader.vue@@ -8,7 +8,7 @@aria-hidden="true":data-prefers-reduced-motion="prefersReducedMotion"data-testid="logo-loader"- class="hover:bg-yellow w-16 h-16 p-4 rounded inline-flex justify-center items-center"+ class="w-12 h-12 p-3 rounded inline-flex justify-center items-center"><pathdata-logo-part-1@@ -51,8 +51,7 @@ export default defineComponent({* @param {import('@nuxtjs/composition-api').SetupContext} context*/setup() {- const defaultWindow = typeof window !== 'undefined' ? window : undefined- const prefersReducedMotion = useReducedMotion({ window: defaultWindow })+ const prefersReducedMotion = useReducedMotion()return { prefersReducedMotion }},diff --git a/src/components/VSearchGrid.vue b/src/components/VSearchGrid.vueindex 7aca05d6f..d4ff4c3ef 100644--- a/src/components/VSearchGrid.vue+++ b/src/components/VSearchGrid.vue@@ -1,5 +1,12 @@<template><section class="search-grid">+ <VSearchResultsTitle+ v-if="query.q && isSupported"+ class="leading-10"+ :size="isAllView ? 'large' : 'default'"+ >+ {{ query.q }}+ </VSearchResultsTitle><divv-if="shouldShowMeta"class="results-meta flex flex-col sm:flex-row items-start justify-between px-6"@@ -115,6 +122,9 @@ export default {const metaSearchFormType = computed(() => {return props.searchType === 'all' ? 'image' : props.searchType})+ const isAllView = computed(() => {+ return props.searchType === 'all'+ })return {mediaCount,@@ -122,6 +132,7 @@ export default {shouldShowMeta,isSupported,metaSearchFormType,+ isAllView,}},}diff --git a/src/components/VSearchResultsTitle.vue b/src/components/VSearchResultsTitle.vuenew file mode 100644index 000000000..d8835ad17--- /dev/null+++ b/src/components/VSearchResultsTitle.vue@@ -0,0 +1,34 @@+<template>+ <h1+ class="leading-tight sr-only md:not-sr-only"+ :class="[size === 'large' ? 'text-[90px]' : 'text-6xl']"+ >+ <slot default />+ </h1>+</template>++<script>+import { defineComponent } from '@nuxtjs/composition-api'+const sizes = {+ DEFAULT: 'default',+ LARGE: 'large',+}+const VSearchResultsTitle = defineComponent({+ name: 'VSearchResultsTitle',+ props: {+ size: {+ required: false,+ default: sizes.DEFAULT,+ validator: (value) => Object.values(sizes).includes(value),+ },+ },+})+export default VSearchResultsTitle+</script>++<style scoped>+/* Title case the user's search query */+h1:first-letter {+ text-transform: uppercase;+}+</style>diff --git a/src/composables/use-event-listener.js b/src/composables/use-event-listener.jsindex 5ce9f3036..266a34900 100644--- a/src/composables/use-event-listener.js+++ b/src/composables/use-event-listener.js@@ -12,18 +12,19 @@ import {* @param {import('@nuxtjs/composition-api').Ref<EventTarget | null> | EventTarget} target The target can be a reactive ref which adds flexibility* @param {string} event* @param {(e: Event) => void} handler+ * @param {any} options*/-export function useEventListener(target, event, handler) {- // if its a reactive ref, use a watcher+export function useEventListener(target, event, handler, options = {}) {+ // if it's a reactive ref, use a watcherif (isRef(target)) {watch(target, (value, oldValue) => {oldValue?.removeEventListener(event, handler)- value?.addEventListener(event, handler)+ value?.addEventListener(event, handler, options)})} else {- // otherwise use the mounted hook+ // otherwise, use the mounted hookonMounted(() => {- target.addEventListener(event, handler)+ target.addEventListener(event, handler, options)})}// clean it updiff --git a/src/composables/use-filter-sidebar-visibility.js b/src/composables/use-filter-sidebar-visibility.jsnew file mode 100644index 000000000..1f4f4a7c6--- /dev/null+++ b/src/composables/use-filter-sidebar-visibility.js@@ -0,0 +1,26 @@+import { onMounted, readonly, ref } from '@nuxtjs/composition-api'+import local from '~/utils/local'++const isFilterSidebarVisible = ref(false)++export function useFilterSidebarVisibility({ mediaQuery }) {+ /**+ * Open or close the filter sidebar+ * @param {boolean} val+ */+ const setFilterSidebarVisibility = (val) => {+ isFilterSidebarVisible.value = val+ local.set(process.env.filterStorageKey, val)+ }++ onMounted(() => {+ const localFilterState = () =>+ local.get(process.env.filterStorageKey) === 'true'+ setFilterSidebarVisibility(mediaQuery && localFilterState())+ })++ return {+ isFilterSidebarVisible: readonly(isFilterSidebarVisible),+ setFilterSidebarVisibility,+ }+}diff --git a/src/composables/use-i18n-utilities.js b/src/composables/use-i18n-utilities.jsnew file mode 100644index 000000000..38d1e2e58--- /dev/null+++ b/src/composables/use-i18n-utilities.js@@ -0,0 +1,24 @@+import { useContext } from '@nuxtjs/composition-api'+import { ALL_MEDIA } from '~/constants/media'++/**+ * Returns the localized text for the number of search results according to the+ * media type.+ *+ * @param {number} resultsCount+ * @param {string} mediaType+ * @returns {string}+ */+export function resultsCount(resultsCount, mediaType = ALL_MEDIA) {+ const { i18n } = useContext()++ const countKey =+ resultsCount === 0+ ? 'no-results'+ : resultsCount >= 10000+ ? 'result-count-more'+ : 'result-count'+ const fullKey = `browse-page.${mediaType}-${countKey}`+ const localeCount = resultsCount.toLocaleString(i18n.locale)+ return i18n.tc(fullKey, resultsCount, { localeCount })+}diff --git a/src/composables/use-match-routes.js b/src/composables/use-match-routes.jsnew file mode 100644index 000000000..b004e9cfd--- /dev/null+++ b/src/composables/use-match-routes.js@@ -0,0 +1,27 @@+import { ref, useRoute, useRouter } from '@nuxtjs/composition-api'++/**+ * Reactive property that returns true only on the matching routes.+ * Note that routes are matched by name, not the url path.+ *+ * @returns {{matches: import('@nuxtjs/composition-api').Ref<boolean>}}+ */+export const useMatchRoute = (routes = []) => {+ const route = useRoute()+ const router = useRouter()+ const matches = ref(routes.includes(route.value.name))+ router.beforeEach((to, from, next) => {+ matches.value = routes.includes(to.name)+ next()+ })+ return { matches }+}++/**+ * Reactive property that returns true only on the `search` routes.+ * Homepage, single image result and other content pages return `false`+ */+export const useMatchSearchRoutes = () =>+ useMatchRoute(['search', 'search-image', 'search-audio', 'search-video'])++export const useMatchHomeRoute = () => useMatchRoute(['index'])diff --git a/src/composables/use-media-query.js b/src/composables/use-media-query.jsindex d253064d6..b33657d5a 100644--- a/src/composables/use-media-query.js+++ b/src/composables/use-media-query.js@@ -2,6 +2,7 @@which, in turn, is ported from https://github.com/logaretm/vue-use-web by Abdelrahman Awad */import { onBeforeUnmount, ref } from '@nuxtjs/composition-api'import { SCREEN_SIZES } from '~/constants/screens.js'+import { defaultWindow } from '~/composables/window'/*** Reactive Media Query.@@ -9,12 +10,12 @@ import { SCREEN_SIZES } from '~/constants/screens.js'* @param query* @param options*/-export function useMediaQuery(query, options = {}) {- const { window } = options- if (!window) return ref(false)+export function useMediaQuery(query, options = { shouldPassInSSR: false }) {+ const { window = defaultWindow } = options+ if (!window) return ref(options.shouldPassInSSR)const mediaQuery = window.matchMedia(query)- /** @type {import('@nuxtjs/composition-api').Ref<boolean>} */+ /** @type {import('@nuxtjs/composition-api').Ref<Boolean>} */const matches = ref(mediaQuery.matches)const handler = (/** @type MediaQueryListEvent */ event) => {@@ -40,9 +41,10 @@ export function useMediaQuery(query, options = {}) {}/**- * Check whether the screen meets the current breakpoint size.+ * Check whether the curent screen meets+ * or exceeds the provided breakpoint size.*/-export const isScreen = (breakpointName, options = {}) => {+export const isMinScreen = (breakpointName, options = {}) => {return useMediaQuery(`(min-width: ${SCREEN_SIZES.get(breakpointName)}px)`,optionsdiff --git a/src/composables/use-window-scroll.js b/src/composables/use-window-scroll.jsnew file mode 100644index 000000000..b322aecf2--- /dev/null+++ b/src/composables/use-window-scroll.js@@ -0,0 +1,51 @@+// code taken from Vueuse+import throttle from 'lodash.throttle'+import { defaultWindow } from '~/composables/window'+import { ref } from '@nuxtjs/composition-api'+import { useEventListener } from '~/composables/use-event-listener'++/**+ * Whether the page has been scrolled down at all+ *+ * @type {import('@nuxtjs/composition-api').Ref<boolean>}+ */+export const isHeaderScrolled = ref(false)++/**+ *+ * @param {object} options+ * @param {Window} [options.window]+ * @param {number} [options.throttleMs] - time to throttle the scroll handler.+ * Set to 0 to remove throttling+ */+export function useWindowScroll({+ window = defaultWindow,+ throttleMs = 200,+} = {}) {+ if (!window) {+ return {+ x: ref(0),+ y: ref(0),+ }+ }++ const x = ref(window.pageXOffset)+ const y = ref(window.pageYOffset)++ const scrollHandler = () => {+ x.value = window.pageXOffset+ y.value = window.pageYOffset+ isHeaderScrolled.value = y.value > 0+ }++ const handler = throttleMs+ ? throttle(scrollHandler, throttleMs)+ : scrollHandler++ useEventListener(window, 'scroll', handler, {+ capture: false,+ passive: true,+ })++ return { x, y, isHeaderScrolled }+}diff --git a/src/composables/window.js b/src/composables/window.jsnew file mode 100644index 000000000..2fa7b45ef--- /dev/null+++ b/src/composables/window.js@@ -0,0 +1,2 @@+export const isClient = typeof window !== 'undefined'+export const defaultWindow = isClient ? window : undefineddiff --git a/src/data/audio-service.js b/src/data/audio-service.jsindex c7221b802..31c999b15 100644--- a/src/data/audio-service.js+++ b/src/data/audio-service.js@@ -1,12 +1,8 @@-import { dev } from '~/utils/dev'-import sampleAudioResponses from './sample-audio-responses.json'-import ApiService from '~/data/api-service'import BaseMediaService from '~/data/base-media-service'import { AUDIO } from '~/constants/media'-// TODO: Remove sample responses when Audio API is availableconst AudioService = {...BaseMediaService(AUDIO),@@ -16,10 +12,6 @@ const AudioService = {* @return {Promise<{data: any}>}*/search(params) {- if (dev) {- const data = JSON.parse(JSON.stringify(sampleAudioResponses.search))- return Promise.resolve({ data })- }return ApiService.query('audio', params)},@@ -37,9 +29,7 @@ const AudioService = {)}- return dev- ? Promise.resolve({ data: sampleAudioResponses.detail })- : ApiService.get('audio', params.id)+ return ApiService.get('audio', params.id)},/**@@ -55,9 +45,7 @@ const AudioService = {)}- return dev- ? Promise.resolve({ data: sampleAudioResponses.related })- : ApiService.get('audio', `${params.id}/related`)+ return ApiService.get('audio', `${params.id}/related`)},}diff --git a/src/data/sample-audio-responses.json b/src/data/sample-audio-responses.jsondeleted file mode 100644index 0b3d7c5e8..000000000--- a/src/data/sample-audio-responses.json+++ /dev/null@@ -1,269 +0,0 @@-{- "search": {- "result_count": 2,- "page_count": 0,- "page_size": 2,- "results": [- {- "id": "8071128a-bebc-4c24-823d-6e26a2e6dfe2",- "title": "Soon and Very Soon (Negro Spiritual)",- "foreign_landing_url": "https://www.jamendo.com/track/382",- "creator": "Les Petits Chanteurs de Montigny",- "creator_url": "https://www.jamendo.com/artist/20/pcmontigny",- "url": "https://mp3d.jamendo.com/download/track/382/mp32",- "license": "by-sa",- "license_version": "2.0",- "license_url": "https://creativecommons.org/licenses/by-sa/2.0/",- "provider": "jamendo",- "source": "jamendo",- "tags": [- {- "name": "chorale"- },- {- "name": "happy"- },- {- "name": "male"- },- {- "name": "vocal"- }- ],- "filetype": "mp3",- "fields_matched": ["tags.name"],- "genres": ["classical", "gospel"],- "detail_url": "http://localhost:8000/v1/audio/8071128a-bebc-4c24-823d-6e26a2e6dfe2",- "related_url": "http://localhost:8000/v1/recommendations/audio/8071128a-bebc-4c24-823d-6e26a2e6dfe2"- },- {- "id": "73e00493-9189-42ed-955b-4f9d26d0d9f4",- "title": "Aimons nous...",- "foreign_landing_url": "https://www.jamendo.com/track/217",- "creator": "David TMX",- "creator_url": "https://www.jamendo.com/artist/14/david.tmx",- "url": "https://mp3d.jamendo.com/download/track/217/mp32",- "license": "by-nc-sa",- "license_version": "2.0",- "license_url": "https://creativecommons.org/licenses/by-nc-sa/2.0/",- "provider": "jamendo",- "source": "jamendo",- "tags": [- {- "name": "happy"- },- {- "name": "male"- },- {- "name": "vocal"- }- ],- "filetype": "mp3",- "fields_matched": ["tags.name"],- "genres": ["metal"],- "detail_url": "http://localhost:8000/v1/audio/73e00493-9189-42ed-955b-4f9d26d0d9f4",- "related_url": "http://localhost:8000/v1/recommendations/audio/73e00493-9189-42ed-955b-4f9d26d0d9f4"- }- ]- },- "related": {- "result_count": 100,- "page_count": 5,- "page_size": 20,- "results": [- {- "id": "deeab14b-f63d-4b41-ac6f-4e3578aff4dd",- "title": "Apologies",- "foreign_landing_url": "https://www.jamendo.com/track/171",- "creator": "TriFace",- "creator_url": "https://www.jamendo.com/artist/7/triface",- "url": "https://mp3d.jamendo.com/download/track/171/mp32",- "license": "by-nc-sa",- "license_version": "2.0",- "license_url": "https://creativecommons.org/licenses/by-nc-sa/2.0/",- "provider": "jamendo",- "source": "jamendo",- "thumbnail": "https://usercontent.jamendo.com/?type=album&id=1290&width=300&trackid=8561",- "tags": [- {- "name": "male"- },- {- "name": "vocal"- }- ],- "category": "music",- "duration": "1000",- "genres": ["hardcore", "metal", "rock"],- "detail_url": "http://localhost:8000/v1/audio/deeab14b-f63d-4b41-ac6f-4e3578aff4dd",- "related_url": "http://localhost:8000/v1/recommendations/audio/deeab14b-f63d-4b41-ac6f-4e3578aff4dd"- },- {- "id": "2a362316-ab88-4a78-a4f4-005afe8025a7",- "title": "J'm'e FPM",- "foreign_landing_url": "https://www.jamendo.com/track/168",- "creator": "TriFace",- "creator_url": "https://www.jamendo.com/artist/7/triface",- "url": "https://mp3d.jamendo.com/download/track/168/mp32",- "license": "by-nc-sa",- "license_version": "2.0",- "license_url": "https://creativecommons.org/licenses/by-nc-sa/2.0/",- "provider": "jamendo",- "source": "jamendo",- "category": "music",- "duration": 1050,- "thumbnail": "https://usercontent.jamendo.com/?type=album&id=1290&width=300&trackid=8561",- "tags": [- {- "name": "male"- },- {- "name": "vocal"- }- ],- "genres": ["hardcore", "metal", "rock"],- "detail_url": "http://localhost:8000/v1/audio/2a362316-ab88-4a78-a4f4-005afe8025a7",- "related_url": "http://localhost:8000/v1/recommendations/audio/2a362316-ab88-4a78-a4f4-005afe8025a7"- },- {- "id": "5a1188f7-853b-4f91-9a4c-fea9d4b58ff9",- "title": "Mind Asylum",- "foreign_landing_url": "https://www.jamendo.com/track/174",- "creator": "Skaut",- "creator_url": "https://www.jamendo.com/artist/9/skaut",- "url": "https://mp3d.jamendo.com/download/track/174/mp32",- "license": "by-nc-sa",- "license_version": "2.0",- "license_url": "https://creativecommons.org/licenses/by-nc-sa/2.0/",- "provider": "jamendo",- "source": "jamendo",- "category": "music",- "duration": "1000",- "tags": [- {- "name": "vocal"- }- ],- "genres": ["rock"],- "detail_url": "http://localhost:8000/v1/audio/5a1188f7-853b-4f91-9a4c-fea9d4b58ff9",- "related_url": "http://localhost:8000/v1/recommendations/audio/5a1188f7-853b-4f91-9a4c-fea9d4b58ff9"- },- {- "id": "c289a688-c528-4673-b640-e407e13256fb",- "title": "Trio HxC",- "foreign_landing_url": "https://www.jamendo.com/track/169",- "creator": "TriFace",- "creator_url": "https://www.jamendo.com/artist/7/triface",- "url": "https://mp3d.jamendo.com/download/track/169/mp32",- "license": "by-nc-sa",- "license_version": "2.0",- "license_url": "https://creativecommons.org/licenses/by-nc-sa/2.0/",- "provider": "jamendo",- "source": "jamendo",- "category": "music",- "duration": "1000",- "tags": [- {- "name": "male"- },- {- "name": "vocal"- }- ],- "genres": ["alternativerock", "hardcore", "metal"],- "detail_url": "http://localhost:8000/v1/audio/c289a688-c528-4673-b640-e407e13256fb",- "related_url": "http://localhost:8000/v1/recommendations/audio/c289a688-c528-4673-b640-e407e13256fb"- },- {- "id": "8071128a-bebc-4c24-823d-6e26a2e6dfe2",- "title": "Soon and Very Soon (Negro Spiritual)",- "foreign_landing_url": "https://www.jamendo.com/track/382",- "creator": "Les Petits Chanteurs de Montigny",- "creator_url": "https://www.jamendo.com/artist/20/pcmontigny",- "url": "https://mp3d.jamendo.com/download/track/382/mp32",- "license": "by-sa",- "license_version": "2.0",- "license_url": "https://creativecommons.org/licenses/by-sa/2.0/",- "provider": "jamendo",- "source": "jamendo",- "category": "music",- "duration": "1000",- "tags": [- {- "name": "chorale"- },- {- "name": "happy"- },- {- "name": "male"- },- {- "name": "vocal"- }- ],- "genres": ["classical", "gospel"],- "detail_url": "http://localhost:8000/v1/audio/8071128a-bebc-4c24-823d-6e26a2e6dfe2",- "related_url": "http://localhost:8000/v1/recommendations/audio/8071128a-bebc-4c24-823d-6e26a2e6dfe2"- }- ]- },- "detail": {- "id": "242c1a4c-0623-436c-a600-7847412d28b6",- "title": "Distance",- "foreign_landing_url": "https://www.jamendo.com/track/8561",- "creator": "Manu Cornet",- "creator_url": "https://www.jamendo.com/artist/1301/manu.cornet",- "url": "https://mp3d.jamendo.com/download/track/8561/mp32",- "license": "by-nc-sa",- "license_version": "2.5",- "license_url": "https://creativecommons.org/licenses/by-nc-sa/2.5/",- "provider": "jamendo",- "source": "jamendo",- "category": "music",- "filetype": "mp32",- "sample_rate": "1.67",- "description": "",- "tags": [- {- "name": "instrumental"- },- {- "name": "neutral"- },- {- "name": "strings"- },- {- "name": "guitar"- },- {- "name": "lounge"- },- {- "name": "peaceful"- }- ],- "thumbnail": "https://usercontent.jamendo.com/?type=album&id=1290&width=300&trackid=8561",- "waveform": "https://localhost:8000/v1/audio/242c1a4c-0623-436c-a600-7847412d28b6/waveform",- "genres": ["jazz", "latinjazz"],- "audio_set": {- "name": "Distance & Temps",- "url": "https://www.jamendo.com/album/1290/distance-and-temps"- },- "alt_files": [- {- "filetype": "flac",- "url": "https://mp3d.jamendo.com/download/track/8561/flac"- },- {- "filetype": "mp31",- "url": "https://mp3d.jamendo.com/download/track/8561/mp31"- }- ],- "duration": 248000,- "detail_url": "http://localhost:8000/v1/audio/242c1a4c-0623-436c-a600-7847412d28b6",- "related_url": "http://localhost:8000/v1/audio/242c1a4c-0623-436c-a600-7847412d28b6/recommendations"- }-}diff --git a/src/layouts/blank.vue b/src/layouts/blank.vuenew file mode 100644index 000000000..5d3ae9c40--- /dev/null+++ b/src/layouts/blank.vue@@ -0,0 +1,3 @@+<template>+ <Nuxt />+</template>diff --git a/src/layouts/default.vue b/src/layouts/default.vueindex bab5ed102..7d27e0439 100644--- a/src/layouts/default.vue+++ b/src/layouts/default.vue@@ -2,24 +2,31 @@<div class="app"><MigrationNotice v-show="isReferredFromCc" /><TranslationStatusBanner />- <HeaderSection />+ <VHeader /><main class="embedded"><Nuxt /></main></div></template>-<script>-import iframeHeight from '~/mixins/iframe-height'--import { NAV } from '~/constants/store-modules'+<script>import { useContext } from '@nuxtjs/composition-api'++import VHeader from '~/components/VHeader/VHeader.vue'+import MigrationNotice from '~/components/MigrationNotice.vue'import TranslationStatusBanner from '~/components/TranslationStatusBanner.vue'-const embeddedPage = {- name: 'embedded',- components: { TranslationStatusBanner },- layout: 'embedded',+import iframeHeight from '~/mixins/iframe-height'+import { NAV } from '~/constants/store-modules'++const defaultLayout = {+ name: 'default',+ components: {+ VHeader,+ MigrationNotice,+ TranslationStatusBanner,+ },+ layout: 'default',mixins: [iframeHeight],head() {return this.$nuxtI18nHead({ addSeoAttributes: true, addDirAttribute: true })@@ -33,5 +40,5 @@ const embeddedPage = {}},}-export default embeddedPage+export default defaultLayout</script>diff --git a/src/layouts/error.vue b/src/layouts/error.vueindex 51c597977..29f09001e 100644--- a/src/layouts/error.vue+++ b/src/layouts/error.vue@@ -1,30 +1,119 @@<template>- <div class="grid-container full">- <main class="not-found">- <h1 v-if="error.statusCode === 404">- {{ $t('error.not-found') }}+ <main class="bg-yellow h-screen relative page-404 overflow-x-hidden">+ <NuxtLink to="/" class="relative z-10">+ <span class="sr-only">{{ $t('404.link-title') }}</span>+ <Logo aria-hidden="true" class="pt-6 lg:pt-8 ms-6 lg:ms-10 w-30 h-auto" />+ </NuxtLink>+ <Oops+ aria-hidden="true"+ class="absolute opacity-5 fill-dark-charcoal -mt-[10%] -ml-[20%] lg:mx-auto w-[140%] lg:w-full px-6 lg:px-16 z-0 pointer-events-none"+ />+ <header+ class="absolute lg:max-w-2xl space-y-4 lg:space-y-6 top-1/4 z-10 left-0 right-0 mx-auto px-6 lg:px-0"+ >+ <h1 class="mb-6 lg:mb-10 lg:leading-tight text-3xl lg:text-6xl">+ {{ $t('404.title') }}</h1>- <h1 v-else>{{ $t('error.occurred') }}</h1>- <p>{{ error.message }}</p>- </main>- </div>+ <p class="font-semibold">+ <i18n path="404.main">+ <template #link>+ <NuxtLink+ class="underline text-current hover:text-current active:text-current"+ to="/"+ >+ {{ $t('404.link-title') }}+ </NuxtLink>+ </template>+ </i18n>+ </p>+ <VSearchBar+ :value="searchTerm"+ :label-text="$t('404.search-placeholder')"+ field-id="404-search"+ :placeholder="$t('404.search-placeholder')"+ @input="setSearchTerm"+ @submit="handleSearch"+ />+ </header>+ </main></template><script>-const HomePage = {- name: 'home-page',+import {+ defineComponent,+ ref,+ useContext,+ useRouter,+} from '@nuxtjs/composition-api'+import { MEDIA, SEARCH } from '~/constants/store-modules'+import { FETCH_MEDIA, UPDATE_QUERY } from '~/constants/action-types'++import Oops from '~/assets/oops.svg?inline'+import Logo from '~/assets/logo.svg?inline'+import VSearchBar from '~/components/VHeader/VSearchBar/VSearchBar'++const Error = defineComponent({+ name: 'ErrorPage',+ components: {+ Logo,+ Oops,+ VSearchBar,+ },+ layout: 'blank',props: ['error'],- layout: 'default',-}+ setup() {+ const { app, store } = useContext()+ const router = useRouter()++ const searchTerm = ref('')+ const setSearchTerm = (value) => {+ searchTerm.value = value+ }++ const handleSearch = async () => {+ if (searchTerm.value === '') return-export default HomePage+ await store.dispatch(`${SEARCH}/${UPDATE_QUERY}`, {+ q: searchTerm.value,+ })+ await store.dispatch(`${MEDIA}/${FETCH_MEDIA}`, {+ query: { q: searchTerm.value },+ })++ router.push(+ app.localePath({+ path: `/search`,+ query: { q: searchTerm.value },+ })+ )+ }++ return {+ searchTerm,+ setSearchTerm,+ handleSearch,+ }+ },+})+export default Error</script>-<style lang="scss" scoped>-.not-found {- height: 71vh;- text-align: center;- font-size: 2em;- padding-top: 10vh;+<style>+/* Override the default search bar styles.+ Maybe in the future this would warrant a+ variant of the searchbar, but that seems+ excessive for this one-off usage.+*/+.page-404 .search-bar > div:not(:focus):not(:focus-within) {+ border-color: black;+}+.page-404+ .search-bar:not(:hover)+ button:not(:hover):not(:focus):not(:focus-within) {+ border-color: black;+ border-inline-start-color: transparent;+}+.page-404 .search-bar button {+ border-width: 1px;}</style>diff --git a/src/layouts/with-nav-search.vue b/src/layouts/with-nav-search.vuedeleted file mode 100644index 2c12d5d06..000000000--- a/src/layouts/with-nav-search.vue+++ /dev/null@@ -1,37 +0,0 @@-<template>- <div class="app">- <MigrationNotice v-show="isReferredFromCc" />- <TranslationStatusBanner />- <HeaderSection :show-nav-search="true" />- <main class="embedded">- <Nuxt />- </main>- </div>-</template>-<script>-import iframeHeight from '~/mixins/iframe-height'--import { NAV } from '~/constants/store-modules'--import TranslationStatusBanner from '~/components/TranslationStatusBanner.vue'-import { useContext } from '@nuxtjs/composition-api'--const embeddedWithNavSearch = {- name: 'embedded-with-nav-search',- components: { TranslationStatusBanner },- layout: 'embedded-with-nav-search',- mixins: [iframeHeight],- head() {- return this.$nuxtI18nHead({ addSeoAttributes: true, addDirAttribute: true })- },- setup() {- const { store } = useContext()- const isReferredFromCc = store.state[NAV].isReferredFromCc-- return {- isReferredFromCc,- }- },-}-export default embeddedWithNavSearch-</script>diff --git a/src/locales/en.json b/src/locales/en.jsonindex 2fa0012bf..b0098c5e7 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -1,4 +1,10 @@{+ "404": {+ "title": "The content you’re looking for seems to have disappeared.",+ "main": "Go to {link} or search for something similar from the field below.",+ "link-title": "Openverse",+ "search-placeholder": "Search for content to reuse"+ },"hero": {"brand": "Openverse","title": "Search for content to reuse",@@ -55,7 +61,17 @@"licenses-nav-item": "The Licenses","about-tab": "About","resources-tab": "Resources",- "api-nav-item": "API"+ "api-nav-item": "API",+ "notification": {+ "text": "{example_notification_text}",+ "dismiss": "Dismiss",+ "okay": "OK"+ },+ "loading": "Loading...",+ "filter-button": {+ "simple": "Filters",+ "with-count": "{count} Filter | {count} Filters"+ }},"footer": {"navigation": {@@ -300,7 +316,6 @@"collection-size": "Collection size: {count} images"},"error": {- "not-found": "Page Not Found","occurred": "An error occurred","image-not-found": "Couldn't find image with id {id}","media-not-found": "Couldn't find {mediaType} with id {id}",@@ -309,9 +324,11 @@},"search-tab": {"all": "All",- "image": "Image",+ "image": "Images","audio": "Audio",- "video": "Video"+ "video": "Video",+ "see-image": "See all images",+ "see-audio": "See all audio"},"filters": {"title": "Filters",@@ -418,7 +435,6 @@"all-result-count-more": "Over {localeCount} results","audio-result-count-more": "Over {localeCount} audio results","image-result-count-more": "Over {localeCount} image results",- "no-more": "No more {type} :(","load": "Load more results","fetching-error": "Error fetching {type}:","search-rating": {diff --git a/src/locales/po-files/openverse.pot b/src/locales/po-files/openverse.potindex ae097f7b3..5dfb7da4a 100644--- a/src/locales/po-files/openverse.pot+++ b/src/locales/po-files/openverse.pot@@ -4,7 +4,7 @@ msgid ""msgstr """Project-Id-Version: Openverse \n""Report-Msgid-Bugs-To: https://github.com/wordpress/openverse/issues \n"-"POT-Creation-Date: 2022-01-06T04:23:46+00:00\n"+"POT-Creation-Date: 2022-01-12T20:51:27+00:00\n""MIME-Version: 1.0\n""Content-Type: text/plain; charset=UTF-8\n""Content-Transfer-Encoding: 8bit\n"@@ -134,7 +134,7 @@ msgctxt "audio-categories.podcast"msgid "Podcast"msgstr ""-#: src/components/Header/SearchBar/SearchButton.vue:7+#: src/components/VHeader/VSearchBar/VSearchButton.vue:7msgctxt "search.search"msgid "Search"msgstr ""@@ -215,7 +215,7 @@ msgctxt "browsers.edge"msgid "Edge"msgstr ""-#: src/components/VMetaSearch/VMetaSearchForm.vue:39+#: src/components/VMetaSearch/VMetaSearchForm.vue:43msgctxt "meta-search.caption"msgid "Openverse does not currently index the sources listed above, but through this interface is offering convenient access to search services provided by other independent organizations. Openverse has no control over the results that are returned. Do not assume that the results displayed in this search portal are under a CC license. Always verify that the work is actually under a CC license by following the link. If you are in doubt, you should contact the copyright holder directly, or try to contact the site where you found the content."msgstr ""@@ -232,13 +232,13 @@ msgid "Not finding what you're looking for? Try additional ###type### sources."msgstr ""#. Do not translate words between ### ###.-#: src/components/VMetaSearch/VMetaSearchForm.vue:4+#: src/components/VMetaSearch/VMetaSearchForm.vue:8msgctxt "meta-search.form.no-results-title"msgid "No ###type### results for \"###query###\"."msgstr ""#. Do not translate words between ### ###.-#: src/components/VMetaSearch/VMetaSearchForm.vue:27+#: src/components/VMetaSearch/VMetaSearchForm.vue:31msgctxt "meta-search.form.caption"msgid "Click on a source below to directly search other collections of CC-licensed ###type###.###break###Please note that Use filters are not supported for ###filter###."msgstr ""@@ -268,42 +268,42 @@ msgctxt "audio-details.genre-label"msgid "Genre"msgstr ""-#: src/components/AudioDetails/Related.vue:4+#: src/components/AudioDetails/VRelatedAudio.vue:4msgctxt "audio-details.related-audios"msgid "Related audios"msgstr ""-#: src/components/AudioDetails/Table.vue:16+#: src/components/AudioDetails/VAudioDetails.vue:12msgctxt "audio-details.table.album"msgid "Album"msgstr ""-#: src/components/AudioDetails/Table.vue:22+#: src/components/AudioDetails/VAudioDetails.vue:18msgctxt "audio-details.table.category"msgid "Type"msgstr ""-#: src/components/AudioDetails/Table.vue:29+#: src/components/AudioDetails/VAudioDetails.vue:25msgctxt "audio-details.table.sample-rate"msgid "Sample Rate"msgstr ""-#: src/components/AudioDetails/Table.vue:37+#: src/components/AudioDetails/VAudioDetails.vue:33msgctxt "audio-details.table.filetype"msgid "Format"msgstr ""-#: src/components/AudioDetails/Table.vue:45+#: src/components/AudioDetails/VAudioDetails.vue:41msgctxt "audio-details.table.provider"msgid "Provider"msgstr ""-#: src/components/AudioDetails/Table.vue:53+#: src/components/AudioDetails/VAudioDetails.vue:49msgctxt "audio-details.table.source"msgid "Source"msgstr ""-#: src/components/AudioDetails/Table.vue:61+#: src/components/AudioDetails/VAudioDetails.vue:57msgctxt "audio-details.table.genre"msgid "Genre"msgstr ""@@ -354,7 +354,7 @@ msgctxt "photo-details.aria.main"msgid "main content"msgstr ""-#: src/components/AudioDetails/Related.vue:2+#: src/components/AudioDetails/VRelatedAudio.vue:2msgctxt "photo-details.aria.related"msgid "related images"msgstr ""@@ -544,7 +544,7 @@ msgctxt "media-details.loading"msgid "Loading..."msgstr ""-#: src/components/AudioDetails/Related.vue:18+#: src/components/AudioDetails/VRelatedAudio.vue:18msgctxt "media-details.related-error"msgid "Error fetching related media"msgstr ""@@ -712,13 +712,7 @@ msgid_plural "Over ###localeCount### image results"msgstr[0] ""msgstr[1] ""-#. Do not translate words between ### ###.-#: src/components/ImageGrid/LoadMoreButton.vue:42-msgctxt "browse-page.no-more"-msgid "No more ###type### :("-msgstr ""--#: src/components/ImageGrid/LoadMoreButton.vue:45+#: src/components/VLoadMore.vue:26msgctxt "browse-page.load"msgid "Load more results"msgstr ""@@ -738,7 +732,7 @@ msgctxt "browse-page.aria.scroll"msgid "scroll to top"msgstr ""-#: src/components/SearchGridForm.vue:25+#: src/components/SearchGridForm.vue:14msgctxt "browse-page.aria.search"msgid "search"msgstr ""@@ -747,7 +741,7 @@ msgctxt "browse-page.aria.remove-filter"msgid "remove filter"msgstr ""-#: src/components/Filters/FilterChecklist.vue:26+#: src/components/VFilters/VFilterChecklist.vue:26msgctxt "browse-page.aria.license-explanation"msgid "license explanation"msgstr ""@@ -781,7 +775,7 @@ msgctxt "browse-page.safer-browsing.label"msgid "Show Mature Content"msgstr ""-#: src/components/Filters/LicenseExplanationTooltip.vue:8+#: src/components/VFilters/VLicenseExplanationTooltip.vue:8msgctxt "browse-page.license-description.title"msgid "License CC"msgstr ""@@ -811,7 +805,7 @@ msgid "This work is marked as being in the public domain."msgstr ""#. Do not translate words between ### ###.-#: src/components/SearchGridForm.vue:79+#: src/components/SearchGridForm.vue:68msgctxt "browse-page.search-form.placeholder"msgid "Search all ###type###"msgstr ""@@ -821,7 +815,7 @@ msgctxt "browse-page.search-form.image"msgid "images"msgstr ""-#: src/pages/search/audio.vue:53+#: src/pages/search/audio.vue:50msgctxt "browse-page.search-form.audio"msgid "audio"msgstr ""@@ -838,7 +832,7 @@ msgctxt "browse-page.search-form.collection-placeholder"msgid "Search this collection"msgstr ""-#: src/components/SearchGridForm.vue:52+#: src/components/SearchGridForm.vue:41msgctxt "browse-page.search-form.button"msgid "Search"msgstr ""@@ -863,22 +857,22 @@ msgctxt "browse-page.search-rating.feedback-thanks"msgid "Thank you for the feedback!"msgstr ""-#: src/components/Filters/SearchGridFilter.vue:12+#: src/components/VFilters/VSearchGridFilter.vue:11msgctxt "filter-list.filter-by"msgid "Filter results by"msgstr ""-#: src/components/Filters/SearchGridFilter.vue:21+#: src/components/VFilters/VSearchGridFilter.vue:16msgctxt "filter-list.hide"msgid "Hide filters"msgstr ""-#: src/components/Filters/SearchGridFilter.vue:45+#: src/components/VFilters/VSearchGridFilter.vue:45msgctxt "filter-list.clear"msgid "Clear filters"msgstr ""-#: src/components/Filters/SearchGridFilter.vue:52+#: src/components/VFilters/VSearchGridFilter.vue:52msgctxt "filter-list.show"msgid "Show results"msgstr ""@@ -888,40 +882,39 @@ msgctxt "filter-list.category-aria"msgid "filters list for ###categoryName### category"msgstr ""-#: src/components/SearchGridForm.vue:15msgctxt "filters.title"msgid "Filters"msgstr ""-#: src/components/Filters/FilterDisplay.vue:4+#: src/components/VFilters/VFilterDisplay.vue:4msgctxt "filters.filter-by"msgid "Filter By"msgstr ""#. Do not translate words between ### ###.-#: src/components/Filters/FilterTag.vue:4+#: src/components/VFilters/VFilterTag.vue:4msgctxt "filters.aria.remove-filter"msgid "Remove ###label### filter"msgstr ""#. Do not translate words between ### ###.-#: src/components/Filters/LicenseExplanationTooltip.vue:12+#: src/components/VFilters/VLicenseExplanationTooltip.vue:12msgctxt "filters.license-explanation.tool"msgid "Read more about the tool ###link###"msgstr ""#. Do not translate words between ### ###.-#: src/components/Filters/LicenseExplanationTooltip.vue:24+#: src/components/VFilters/VLicenseExplanationTooltip.vue:24msgctxt "filters.license-explanation.license"msgid "Read more about the license ###link###"msgstr ""-#: src/components/Filters/LicenseExplanationTooltip.vue:20+#: src/components/VFilters/VLicenseExplanationTooltip.vue:20msgctxt "filters.license-explanation.link"msgid "here"msgstr ""-#: src/components/Filters/FilterChecklist.vue:83+#: src/components/VFilters/VFilterChecklist.vue:85msgctxt "filters.searchBy.title"msgid "Search By"msgstr ""@@ -1119,7 +1112,7 @@ msgid "All"msgstr ""msgctxt "search-tab.image"-msgid "Image"+msgid "Images"msgstr ""msgctxt "search-tab.audio"@@ -1130,18 +1123,20 @@ msgctxt "search-tab.video"msgid "Video"msgstr ""-#: src/layouts/error.vue:5-msgctxt "error.not-found"-msgid "Page Not Found"+msgctxt "search-tab.see-image"+msgid "See all images"+msgstr ""++msgctxt "search-tab.see-audio"+msgid "See all audio"msgstr ""-#: src/layouts/error.vue:7msgctxt "error.occurred"msgid "An error occurred"msgstr ""#. Do not translate words between ### ###.-#: src/pages/image/_id.vue:57+#: src/pages/image/_id.vue:54msgctxt "error.image-not-found"msgid "Couldn't find image with id ###id###"msgstr ""@@ -2021,6 +2016,34 @@ msgctxt "header.api-nav-item"msgid "API"msgstr ""+#: src/components/VHeader/VHeader.vue:144+msgctxt "header.loading"+msgid "Loading..."+msgstr ""++#: src/components/VHeader/VFilterButton.vue:87+msgctxt "header.filter-button.simple"+msgid "Filters"+msgstr ""++#. Do not translate words between ### ###.+#: src/components/VHeader/VFilterButton.vue:82+msgctxt "header.filter-button.with-count"+msgid "###count### Filter | ###count### Filters"+msgstr ""++msgctxt "header.notification.text"+msgid "{example_notification_text}"+msgstr ""++msgctxt "header.notification.dismiss"+msgid "Dismiss"+msgstr ""++msgctxt "header.notification.okay"+msgid "OK"+msgstr ""+#: src/components/NavSection.vue:6msgctxt "header.aria.primary"msgid "primary"@@ -2138,3 +2161,24 @@ msgstr ""msgctxt "hero.search.button"msgid "Search"msgstr ""++#: src/layouts/error.vue:15+msgctxt "404.title"+msgid "The content you’re looking for seems to have disappeared."+msgstr ""++#. Do not translate words between ### ###.+#: src/layouts/error.vue:18+msgctxt "404.main"+msgid "Go to ###link### or search for something similar from the field below."+msgstr ""++#: src/layouts/error.vue:4+msgctxt "404.link-title"+msgid "Openverse"+msgstr ""++#: src/layouts/error.vue:31+msgctxt "404.search-placeholder"+msgid "Search for content to reuse"+msgstr ""diff --git a/src/pages/about.vue b/src/pages/about.vueindex a1d950ad0..cc484c06e 100644--- a/src/pages/about.vue+++ b/src/pages/about.vue@@ -98,7 +98,6 @@<script>const AboutPage = {name: 'about-page',- layout: 'with-nav-search',}export default AboutPagediff --git a/src/pages/audio/_id.vue b/src/pages/audio/_id.vueindex 546089789..51d5a3950 100644--- a/src/pages/audio/_id.vue+++ b/src/pages/audio/_id.vue@@ -34,7 +34,6 @@ import { MEDIA } from '~/constants/store-modules'const AudioDetailPage = {name: 'AudioDetailPage',mixins: [iframeHeight],- layout: 'with-nav-search',data() {return {thumbnailURL: null,diff --git a/src/pages/extension.vue b/src/pages/extension.vueindex e62b6d9be..7e32b7717 100644--- a/src/pages/extension.vue+++ b/src/pages/extension.vue@@ -75,7 +75,6 @@ import feature3 from '~/assets/screenshots/extension_feat_3.png'const AboutPage = {name: 'about-page',components: { ExtensionBrowsers },- layout: 'with-nav-search',data() {const features = [{ key: 'search', image: feature1 },diff --git a/src/pages/feedback.vue b/src/pages/feedback.vueindex 92eed38ff..82e8144c3 100644--- a/src/pages/feedback.vue+++ b/src/pages/feedback.vue@@ -71,7 +71,6 @@ const suggestionForm =export const FeedbackPage = {name: 'feedback-page',- layout: 'with-nav-search',data() {return {activeTab: 0,diff --git a/src/pages/image/_id.vue b/src/pages/image/_id.vueindex 8b9957675..fc0d1f190 100644--- a/src/pages/image/_id.vue+++ b/src/pages/image/_id.vue@@ -25,7 +25,6 @@ import VPhotoDetails from '~/components/ImageDetails/VPhotoDetails.vue'const PhotoDetailPage = {name: 'PhotoDetailPage',components: { RelatedImages, VPhotoDetails },- layout: 'with-nav-search',data() {return {breadCrumbURL: '',diff --git a/src/pages/meta-search.vue b/src/pages/meta-search.vueindex 61468fd52..b4b63af0f 100644--- a/src/pages/meta-search.vue+++ b/src/pages/meta-search.vue@@ -118,7 +118,6 @@<script>export default {name: 'MetaSearchPage',- layout: 'with-nav-search',}</script>diff --git a/src/pages/search-help.vue b/src/pages/search-help.vueindex 91527e845..a893712f9 100644--- a/src/pages/search-help.vue+++ b/src/pages/search-help.vue@@ -255,7 +255,6 @@<script>const SearchHelpPage = {name: 'search-help-page',- layout: 'with-nav-search',methods: {providerSearchLink(providerCode) {return `https://search.creativecommons.org/search?q=provider%3A%20"${providerCode}"`diff --git a/src/pages/search.vue b/src/pages/search.vueindex 2b18d1fd6..6de858f5e 100644--- a/src/pages/search.vue+++ b/src/pages/search.vue@@ -3,15 +3,15 @@<div class="search columns"><Component:is="searchFilter.as"- v-if="isFilterVisible"+ v-if="isFilterSidebarVisible"+ id="filter-sidebar":class="searchFilter.classes"@close="onToggleSearchGridFilter"- ><SearchGridFilter+ ><VSearchGridFilter @close="onToggleSearchGridFilter"/></Component><div class="column search-grid-ctr">- <SearchGridForm @onSearchFormSubmit="onSearchFormSubmit" /><SearchTypeTabs class="mb-4" />- <FilterDisplay v-show="shouldShowFilterTags" />+ <VFilterDisplay v-show="shouldShowFilterTags" /><VSearchGrid:id="`tab-${searchType}`"role="tabpanel"@@ -28,7 +28,7 @@:key="$route.path":media-results="results":fetch-state="fetchState"- :is-filter-visible="isFilterVisible"+ :is-filter-visible="isFilterSidebarVisible":search-term="query.q":supported="supported"data-testid="search-results"@@ -48,35 +48,41 @@ import {SET_SEARCH_STATE_FROM_URL,UPDATE_SEARCH_TYPE,} from '~/constants/action-types'-import { SET_FILTER_IS_VISIBLE } from '~/constants/mutation-types'import { queryStringToSearchType } from '~/utils/search-query-transform'-import local from '~/utils/local'import { ALL_MEDIA, AUDIO, IMAGE } from '~/constants/media'-import { mapActions, mapGetters, mapMutations, mapState } from 'vuex'+import { mapActions, mapGetters, mapState } from 'vuex'import { MEDIA, SEARCH } from '~/constants/store-modules'import debounce from 'lodash.debounce'-import { isScreen } from '~/composables/use-media-query.js'+import { isMinScreen } from '~/composables/use-media-query.js'+import { useFilterSidebarVisibility } from '~/composables/use-filter-sidebar-visibility'import AppModal from '~/components/AppModal.vue'import VScrollButton from '~/components/VScrollButton.vue'import VSearchGrid from '~/components/VSearchGrid.vue'-import SearchGridFilter from '~/components/Filters/SearchGridFilter.vue'+import VSearchGridFilter from '~/components/VFilters/VSearchGridFilter.vue'+import VFilterDisplay from '~/components/VFilters/VFilterDisplay.vue'const BrowsePage = {name: 'browse-page',layout: 'default',components: {AppModal,- SearchGridFilter,+ VFilterDisplay,+ VSearchGridFilter,VScrollButton,VSearchGrid,},setup() {- const defaultWindow = typeof window !== 'undefined' ? window : undefined- const isMdScreen = isScreen('md', defaultWindow)+ const isMdScreen = isMinScreen('md')+ const { isFilterSidebarVisible, setFilterSidebarVisibility } =+ useFilterSidebarVisibility({ mediaQuery: isMdScreen })+return {isMdScreen,+ isFilterSidebarVisible,++ setFilterSidebarVisibility,}},scrollToTop: false,@@ -102,20 +108,13 @@ const BrowsePage = {}},mounted() {- const localFilterState = () =>- local.get(process.env.filterStorageKey)- ? local.get(process.env.filterStorageKey) === 'true'- : true- this.setFilterVisibility({- isFilterVisible: this.isMdScreen && localFilterState(),- })window.addEventListener('scroll', this.debounceScrollHandling)},beforeDestroy() {window.removeEventListener('scroll', this.debounceScrollHandling)},computed: {- ...mapState(SEARCH, ['query', 'isFilterVisible', 'searchType']),+ ...mapState(SEARCH, ['query', 'searchType']),...mapGetters(SEARCH, ['searchQueryParams', 'isAnyFilterApplied']),...mapGetters(MEDIA, ['results', 'fetchState']),mediaType() {@@ -159,9 +158,6 @@ const BrowsePage = {updateSearchType: UPDATE_SEARCH_TYPE,updateQuery: UPDATE_QUERY,}),- ...mapMutations(SEARCH, {- setFilterVisibility: SET_FILTER_IS_VISIBLE,- }),async getMediaItems(params) {if (this.query.q.trim() !== '') {await this.fetchMedia({ ...params })@@ -171,9 +167,7 @@ const BrowsePage = {this.updateQuery({ q })},onToggleSearchGridFilter() {- this.setFilterVisibility({- isFilterVisible: !this.isFilterVisible,- })+ this.setFilterSidebarVisibility(!this.isFilterSidebarVisible)},checkScrollLength() {this.showScrollButton = window.scrollY > 70@@ -215,7 +209,6 @@ export default BrowsePagemargin: 0;}.search-grid-ctr {- background-color: $color-wp-gray-0;min-height: 600px;padding: 0;diff --git a/src/pages/search/audio.vue b/src/pages/search/audio.vueindex 705242b88..c8b113da9 100644--- a/src/pages/search/audio.vue+++ b/src/pages/search/audio.vue@@ -1,10 +1,10 @@<template>- <section>+ <section class="px-6"><template v-if="supported"><VAudioTrackv-for="audio in mediaResults.items":key="audio.id"- class="px-6 mb-6"+ class="mb-6":audio="audio":size="audioTrackSize"layout="row"@@ -14,12 +14,9 @@<h5>{{ errorHeader }}</h5><p>{{ fetchState.fetchingError }}</p></template>- <LoadMoreButton- v-if="canLoadMore"- :is-error="isError"+ <VLoadMore+ v-if="canLoadMore && !fetchState.isFinished":is-fetching="fetchState.isFetching"- :is-finished="fetchState.isFinished"- media-type="audio"data-testid="load-more"@onLoadMore="onLoadMore"/>@@ -32,7 +29,7 @@ import { computed, defineComponent, useContext } from '@nuxtjs/composition-api'import { useLoadMore } from '~/composables/use-load-more'import VAudioTrack from '~/components/VAudioTrack/VAudioTrack.vue'-import LoadMoreButton from '~/components/ImageGrid/LoadMoreButton.vue'+import VLoadMore from '~/components/VLoadMore.vue'import { propTypes } from './search-page.types'@@ -40,7 +37,7 @@ const AudioSearch = defineComponent({name: 'AudioSearch',components: {VAudioTrack,- LoadMoreButton,+ VLoadMore,},props: propTypes,setup(props) {diff --git a/src/pages/sources.vue b/src/pages/sources.vueindex 0c3fd6656..72e537483 100644--- a/src/pages/sources.vue+++ b/src/pages/sources.vue@@ -151,7 +151,6 @@ const ARABIC_NUMERAL_LOCALES = ['ar', 'fa', 'ur', 'ckb', 'ps']const SourcePage = {name: 'source-page',- layout: 'with-nav-search',data() {return {sort: {diff --git a/src/store/media.js b/src/store/media.jsindex 27e4d8d31..75ae3bd06 100644--- a/src/store/media.js+++ b/src/store/media.js@@ -228,11 +228,10 @@ export const getters = {* Returns the search result data related for selected media.* @param {import('./types').MediaState} state* @param getters- * @param rootState* @return {import('./types').MediaStoreResult}*/- results(state, getters, rootState) {- return state.results[rootState.search.query.mediaType] || null+ results(state, getters) {+ return getters.mediaType ? state.results[getters.mediaType] : {}},/*** Search fetching state for selected media type.diff --git a/src/styles/global.scss b/src/styles/global.scssindex 3a587b5ed..2d43c889f 100644--- a/src/styles/global.scss+++ b/src/styles/global.scss@@ -65,8 +65,3 @@.photo_related-images .search-grid-cells {margin: 10px -10px !important;}--// border above content area-main {- border-top: 1px solid $color-transition-gray;-}diff --git a/tailwind.config.js b/tailwind.config.jsindex 7867965bf..32ee6b670 100644--- a/tailwind.config.js+++ b/tailwind.config.js@@ -8,7 +8,10 @@ module.exports = {],theme: {screens: Object.fromEntries(- Array.from(SCREEN_SIZES, ([name, width]) => [name, `${width}px`])+ Array.from(SCREEN_SIZES, ([name, width]) => [+ name,+ `${width}px`,+ ]).reverse()),colors: {// Accents@@ -76,6 +79,7 @@ module.exports = {4: '1.00rem',5: '1.25rem',6: '1.50rem',+ 7: '1.75rem',8: '2.00rem',10: '2.50rem',12: '3.00rem',@@ -185,6 +189,7 @@ module.exports = {],heading: ['"Inter"', 'sans-serif'],mono: ['"JetBrains Mono"', 'monospace'],+ serif: ['Times New Roman'],icons: ['"Vocabulary Icons"'],},extend: {diff --git a/test/e2e/content-types.spec.js b/test/e2e/content-types.spec.jsindex 110590add..78a95f25c 100644--- a/test/e2e/content-types.spec.js+++ b/test/e2e/content-types.spec.js@@ -41,7 +41,7 @@ const contentTypes = [},{id: 'image',- name: 'Image',+ name: 'Images',url: '/search/image/?q=cat',supported: true,sources: 6,@@ -50,7 +50,7 @@ const contentTypes = [id: 'audio',name: 'Audio',url: '/search/audio/?q=cat',- supported: true,+ supported: false,sources: 5,},{@@ -63,7 +63,7 @@ const contentTypes = []for (const [i, contentType] of contentTypes.entries()) {- test(`Can open ${contentType.name} page on SSR`, async ({ page }) => {+ test(`Can open ${contentType.name} search page on SSR`, async ({ page }) => {await page.goto(contentType.url)// Selected content page@@ -88,13 +88,12 @@ for (const [i, contentType] of contentTypes.entries()) {await expect(searchResult).not.toBeEmpty()}- // Load more, skip on audio- // @todo: Restore on audio when production audio data is live- if (contentType.supported && contentType.id !== 'audio') {- const loadMoreSection = await page.locator('[data-testid="load-more"]')- await expect(loadMoreSection).toHaveCount(1)- const expectedText = 'Load more'- await expect(loadMoreSection).toContainText(expectedText)+ // Load more+ if (contentType.supported) {+ const loadMoreBtn = await page.locator(+ 'button:has-text("Load more results")'+ )+ await expect(loadMoreBtn).toHaveCount(1)}// MetaSearch formdiff --git a/test/e2e/filters.spec.js b/test/e2e/filters.spec.jsindex af8f7bc19..c8a633635 100644--- a/test/e2e/filters.spec.js+++ b/test/e2e/filters.spec.js@@ -1,5 +1,16 @@const { test, expect } = require('@playwright/test')+const openFilters = async (page) => {+ const filterButtonSelector =+ '[aria-controls="filter-sidebar"], [aria-controls="filter-modal"]'+ const isPressed = async () =>+ await page.getAttribute(filterButtonSelector, 'aria-pressed')+ if ((await isPressed()) !== 'true') {+ await page.click(filterButtonSelector)+ expect(await isPressed()).toEqual('true')+ }+}+test.beforeEach(async ({ context }) => {// Block any image or audio (jamendo.com) requests for each test in this file.await context.route(/\.(png|jpeg|jpg|svg)$/, (route) => route.abort())@@ -25,7 +36,12 @@ test('can unset filters using filter tags', async ({ page }) => {await page.goto('/search/image?q=cat&license=cc0')const cc0Tag = page.locator('[aria-label="Remove CC0 filter"]')- const cc0Checkbox = page.locator('aside >> text=CC0')+ await openFilters(page)+ expect(await page.getAttribute('[aria-label="1 Filter"]', 'aria-label')).toBe(+ '1 Filter'+ )+ const cc0Checkbox = page.locator('label:has-text("CC0")')+await expect(cc0Checkbox).toBeChecked()await expect(cc0Tag).toHaveCount(1)page.on('requestfinished', (request) => {@@ -41,8 +57,6 @@ test('can unset filters using filter tags', async ({ page }) => {await expect(page).toHaveURL('/search/image?q=cat')await expect(cc0Checkbox).not.toBeChecked()await expect(page.locator('[aria-label="Remove CC0 filter"]')).toHaveCount(0)-- await cc0Checkbox.click()})test('filters are updated when media type changes', async ({ page }) => {@@ -51,9 +65,11 @@ test('filters are updated when media type changes', async ({ page }) => {route.fulfill({ path: 'test/e2e/resources/mock_data.json' }))await page.goto('/search/image?q=cat&aspect_ratio=tall')+ await openFilters(page)const tallTag = page.locator('[aria-label="Remove Tall filter"]')- const tallCheckbox = page.locator('aside >> text=Tall')+ const tallCheckbox = page.locator('label:has-text("Tall")')+await expect(tallCheckbox).toBeChecked()await expect(tallTag).toHaveCount(1)@@ -81,7 +97,9 @@ test('new media request is sent when a filter is selected', async ({})await page.goto('/search/image?q=cat')- const cc0Checkbox = page.locator('aside >> text=CC0')+ await openFilters(page)++ const cc0Checkbox = page.locator('label:has-text("CC0")')await expect(cc0Checkbox).not.toBeChecked()await cc0Checkbox.click()diff --git a/test/e2e/search-query-client.spec.js b/test/e2e/search-query-client.spec.jsindex 8db198903..d786d5a7b 100644--- a/test/e2e/search-query-client.spec.js+++ b/test/e2e/search-query-client.spec.js@@ -32,7 +32,7 @@ test.beforeEach(async ({ context }) => {test('q query parameter is set as the search term', async ({ page }) => {await page.goto('/')- const searchInput = page.locator('input[type="search"]')+ const searchInput = page.locator('[placeholder="Search all content"]')await searchInput.type('cat')await page.click('button:has-text("Search")')@@ -45,11 +45,13 @@ test('selecting `audio` on homepage, you can search for audio', async ({}) => {await page.goto('/')- await page.type('input[type="search"]', 'cat')+ await page.type('[placeholder="Search all content"]', 'cat')await page.click('button:has-text("Audio")')await page.click('button:has-text("Search")')- await expect(page.locator('input[type="search"]')).toHaveValue('cat')+ await expect(page.locator('[placeholder="Search all content"]')).toHaveValue(+ 'cat'+ )const activeTabLabel = await page.locator('[role="tab"][aria-selected="true"]').textContent()@@ -62,15 +64,17 @@ test('selecting license type filter on homepage applies filters', async ({}) => {await page.goto('/')- await page.type('input[type="search"]', 'cat')+ await page.type('[placeholder="Search all content"]', 'cat')await page.click('label:has-text("Use commercially")')await page.click('button:has-text("Search")')- await expect(page.locator('input[type="search"]')).toHaveValue('cat')+ await expect(page.locator('[placeholder="Search all content"]')).toHaveValue(+ 'cat'+ )const activeTabLabel = await page.locator('[role="tab"][aria-selected="true"]').textContent()- expect(activeTabLabel.trim()).toEqual('Image')+ expect(activeTabLabel.trim()).toEqual('Images')await expect(page).toHaveURL('search/image?q=cat&license_type=commercial')})diff --git a/test/e2e/search-query-server.spec.js b/test/e2e/search-query-server.spec.jsindex ced6aa2ed..2de406aed 100644--- a/test/e2e/search-query-server.spec.js+++ b/test/e2e/search-query-server.spec.js@@ -12,6 +12,17 @@ const { test, expect } = require('@playwright/test')* All of these tests test server-generated search page, not the one generated on the client*/+const openFilters = async (page) => {+ const filterButtonSelector =+ '[aria-controls="filter-sidebar"], [aria-controls="filter-modal"]'+ const isPressed = async () =>+ await page.getAttribute(filterButtonSelector, 'aria-pressed')+ if ((await isPressed()) !== 'true') {+ await page.click(filterButtonSelector)+ expect(await isPressed()).toEqual('true')+ }+}+test.beforeEach(async ({ context }) => {// Block any image or audio (jamendo.com) requests for each test in this file.await context.route(/\.(png|jpeg|jpg|svg)$/, (route) => route.abort())@@ -36,7 +47,8 @@ test('q query parameter is set as the search term', async ({ page }) => {const searchInput = page.locator('input[type="search"]')await expect(searchInput).toHaveValue('cat')- await expect(searchInput).toBeFocused()+ // Todo: focus the input?+ // await expect(searchInput).toBeFocused()})test('url path /search/ is used to select `all` search tab', async ({@@ -69,20 +81,14 @@ test('url query to filter, all tab, one parameter per filter type', async ({'/search/?q=cat&license=cc0&license_type=commercial&searchBy=creator')- // Have to specify `aside` because there are technically two filter lists on the page:- // aside for desktop, and a modal for mobile view.- const cc0 = page.locator('aside input[type="checkbox"][value="cc0"]')- await expect(cc0).toBeChecked()+ await openFilters(page)+ const cc0Checkbox = await page.locator('label:has-text("CC0")')+ await expect(cc0Checkbox).toBeChecked()- const commercial = page.locator(- 'aside input[type="checkbox"][value="commercial"]'- )+ const commercial = await page.locator('label:text-matches("commercial", "i")')await expect(commercial).toBeChecked()- // TODO (obulat): Check that this checkbox has a clear a11y name- const searchByCreator = page.locator(- 'aside input[type="checkbox"][value="creator"]'- )+ const searchByCreator = await page.locator('label:has-text("Creator")')await expect(searchByCreator).toBeChecked()})@@ -92,17 +98,18 @@ test('url query to filter, image tab, several filters for one filter type selectawait page.goto('/search/image?q=cat&searchBy=creator&extension=jpg,png,gif,svg')+ await openFilters(page)- const jpg = page.locator('aside input[type="checkbox"][value="jpg"]')- await expect(jpg).toBeChecked()+ const jpeg = page.locator('label:text-matches("jp(e*)g", "i")')+ await expect(jpeg).toBeChecked()- const png = page.locator('aside input[type="checkbox"][value="png"]')+ const png = page.locator('label:text-matches("png", "i")')await expect(png).toBeChecked()- const gif = page.locator('aside input[type="checkbox"][value="gif"]')+ const gif = page.locator('label:text-matches("gif", "i")')await expect(gif).toBeChecked()- const svg = page.locator('aside input[type="checkbox"][value="svg"]')+ const svg = page.locator('label:text-matches("svgs", "i")')await expect(svg).toBeChecked()})diff --git a/test/e2e/search.spec.js b/test/e2e/search.spec.jsindex 25820ab8a..5dd432c27 100644--- a/test/e2e/search.spec.js+++ b/test/e2e/search.spec.js@@ -22,10 +22,6 @@ test.beforeEach(async ({ context }) => {test('does not show an error message before search', async ({ page }) => {await page.goto('/search')- // The search meta data under the search input, should not be shown if no- // media had been fetched- await expect(page.locator('text=No image results')).not.toBeVisible()-// Load more button, should not be shown if the `q` parameter is not setawait expect(page.locator('button:has-text("Load more results")'))diff --git a/test/unit/specs/components/ImageDetails/v-photo-details.spec.js b/test/unit/specs/components/ImageDetails/v-photo-details.spec.jsindex d247b058a..d19038933 100644--- a/test/unit/specs/components/ImageDetails/v-photo-details.spec.js+++ b/test/unit/specs/components/ImageDetails/v-photo-details.spec.js@@ -45,6 +45,10 @@ describe('PhotoDetails', () => {}dispatchMock = jest.fn()+ const routerMock = {+ push: jest.fn(),+ back: jest.fn(),+ }const routeMock = {params: {location: window.scrollY,@@ -74,6 +78,7 @@ describe('PhotoDetails', () => {store: storeMock,},},+ $router: routerMock,},store: storeMock,i18n,diff --git a/test/unit/specs/components/InputField/input-field.spec.js b/test/unit/specs/components/InputField/input-field.spec.jsindex 7bb4a736d..52a778dc3 100644--- a/test/unit/specs/components/InputField/input-field.spec.js+++ b/test/unit/specs/components/InputField/input-field.spec.js@@ -1,10 +1,10 @@import { render, screen } from '@testing-library/vue'-import InputField from '~/components/InputField/InputField.vue'+import VInputField from '~/components/VInputField/VInputField.vue'-describe('InputField', () => {- it('should render an `input` element with type="text"', () => {- render(InputField, {+describe('VInputField', () => {+ xit('should render an `input` element with type="text"', () => {+ render(VInputField, {attrs: {placeholder: 'Enter some text',},@@ -13,15 +13,15 @@ describe('InputField', () => {labelText: 'Label',},})-+ screen.debug()const element = screen.getByPlaceholderText('Enter some text')expect(element.tagName).toBe('INPUT')expect(element).toHaveAttribute('type', 'text')})- it('should allow changing the type', () => {- render(InputField, {+ xit('should allow changing the type', () => {+ render(VInputField, {attrs: {placeholder: 'Enter some number',type: 'number',@@ -38,7 +38,7 @@ describe('InputField', () => {})it('should set the ID on the `input` to allow attaching labels', () => {- render(InputField, {+ render(VInputField, {attrs: {placeholder: 'Enter some text',},@@ -54,7 +54,7 @@ describe('InputField', () => {})it('should render the label text connected to the input field if specified', () => {- render(InputField, {+ render(VInputField, {propsData: {fieldId: 'input-id',labelText: 'Label',diff --git a/test/unit/specs/components/Header/SearchBar/search-bar.spec.js b/test/unit/specs/components/VHeader/SearchBar/search-bar.spec.jssimilarity index 92%rename from test/unit/specs/components/Header/SearchBar/search-bar.spec.jsrename to test/unit/specs/components/VHeader/SearchBar/search-bar.spec.jsindex 265121ff4..489c57209 100644--- a/test/unit/specs/components/Header/SearchBar/search-bar.spec.js+++ b/test/unit/specs/components/VHeader/SearchBar/search-bar.spec.js@@ -1,6 +1,6 @@import { render, screen } from '@testing-library/vue'-import SearchBar from '~/components/Header/SearchBar/SearchBar.vue'+import SearchBar from '~/components/VHeader/VSearchBar/VSearchBar.vue'describe('SearchBar', () => {it('renders an input field with placeholder and type="search"', () => {diff --git a/test/unit/specs/components/VHeader/v-filter-button.spec.js b/test/unit/specs/components/VHeader/v-filter-button.spec.jsnew file mode 100644index 000000000..dd80894ff--- /dev/null+++ b/test/unit/specs/components/VHeader/v-filter-button.spec.js@@ -0,0 +1,140 @@+import { render, screen } from '@testing-library/vue'++import VFilterButton from '~/components/VHeader/VFilterButton.vue'+import { createLocalVue } from '@vue/test-utils'+import Vuex from 'vuex'+import VueI18n from 'vue-i18n'+import messages from '../../../../../src/locales/en.json'+import { isMinScreen } from '~/composables/use-media-query'++/**+ * For some reason I need to mock the implementation+ * of this mock in each test, or it doesn't work.+ *+ * In each implementation I'm faking returning a ref+ * with `mockImplementation(() => ({value: true}))`+ * that may be related.+ */+jest.mock('~/composables/use-media-query', () => ({+ isMinScreen: jest.fn(),+}))++describe('VFilterButton', () => {+ let options = {}+ let storeMock+ let localVue+ let appliedFilters = []+ let props = {}++ const i18n = new VueI18n({+ locale: 'en',+ localeProperties: {+ dir: 'ltr',+ },+ fallbackLocale: 'en',+ messages: { en: messages },+ })+ beforeEach(() => {+ localVue = createLocalVue()+ localVue.use(Vuex)+ localVue.use(VueI18n)++ storeMock = new Vuex.Store({+ modules: {+ search: {+ namespaced: true,+ getters: {+ isAnyFilterApplied: () => appliedFilters.length > 0,+ appliedFilterTags: () => appliedFilters,+ },+ },+ },+ })+ options = {+ localVue,+ propsData: props,+ mocks: {+ $nuxt: {+ context: {+ store: storeMock,+ i18n,+ },+ },+ },+ }+ })++ describe('Above the medium breakpoint', () => {+ it('always shows the label and icon', () => {+ isMinScreen.mockImplementation(() => ({ value: true }))+ const { container } = render(VFilterButton, options)++ const button = screen.getByText('Filters')+ const icon = container.querySelector('svg')++ expect(button).toBeVisible()+ expect(icon).toBeVisible()+ })+ it('shows the count and text when filters are applied', () => {+ isMinScreen.mockImplementation(() => ({ value: true }))+ // +2 to guarantee it's plural+ const filterCount = Math.floor(Math.random() * 10) + 2+ appliedFilters = Array(filterCount).fill('')+ render(VFilterButton, options)++ const button = screen.getByText(`${filterCount} Filters`)++ expect(button).toBeVisible()+ })+ it('does not show the icon when filters are applied', () => {+ isMinScreen.mockImplementation(() => ({ value: true }))+ appliedFilters = ['mockfilter1', 'mockfilter2']++ const { container } = render(VFilterButton, options)+ const icon = container.querySelector('svg')++ expect(icon).not.toBeInTheDocument()+ })+ })++ describe('below the medium breakpoint', () => {+ it('only shows the filter icon by default', () => {+ isMinScreen.mockImplementation(() => ({ value: false }))+ appliedFilters = []+ const { container } = render(VFilterButton, options)++ const icon = container.querySelector('svg')+ const label = screen.queryByTestId('filterbutton-label')++ expect(icon).toBeVisible()+ expect(label).not.toBeInTheDocument()+ })+ it('only shows the count and label when filters are applied', () => {+ isMinScreen.mockImplementation(() => ({ value: false }))+ // +2 to guarantee it's plural+ const filterCount = Math.floor(Math.random() * 10) + 2+ appliedFilters = Array(filterCount).fill('')+ const { container } = render(VFilterButton, options)++ const icon = container.querySelector('svg')+ const button = screen.getByText(`${filterCount} Filters`)++ expect(icon).not.toBeInTheDocument()+ expect(button).toBeVisible()+ })+ it('only shows the count when filters are applied and the user scrolls', () => {+ isMinScreen.mockImplementation(() => ({ value: false }))+ // +2 to guarantee it's plural+ const filterCount = Math.floor(Math.random() * 10) + 2+ appliedFilters = Array(filterCount).fill('')+ props.isHeaderScrolled = true+ const { container } = render(VFilterButton, options)++ const icon = container.querySelector('svg')+ const button = screen.getByText(filterCount)++ expect(icon).not.toBeInTheDocument()+ expect(button).toBeVisible()+ })+ })+})diff --git a/test/unit/specs/components/filter-checklist.spec.js b/test/unit/specs/components/filter-checklist.spec.jsindex cae034fd2..c944c36a5 100644--- a/test/unit/specs/components/filter-checklist.spec.js+++ b/test/unit/specs/components/filter-checklist.spec.js@@ -1,5 +1,4 @@-import FilterChecklist from '~/components/Filters/FilterChecklist'-import VCheckbox from '~/components/VCheckbox'+import FilterChecklist from '~/components/VFilters/VFilterChecklist'import { createLocalVue } from '@vue/test-utils'import { fireEvent, render, screen } from '@testing-library/vue'@@ -10,7 +9,6 @@ describe('FilterChecklist', () => {beforeEach(() => {localVue = createLocalVue()- localVue.component('VCheckbox', VCheckbox)props = {options: [{ code: 'foo', name: 'bar', checked: false }],title: 'Foo',diff --git a/test/unit/specs/components/filter-display.spec.js b/test/unit/specs/components/filter-display.spec.jsindex 3340fdeca..ba218a2de 100644--- a/test/unit/specs/components/filter-display.spec.js+++ b/test/unit/specs/components/filter-display.spec.js@@ -1,6 +1,6 @@import { render } from '@testing-library/vue'-import FilterDisplay from '~/components/Filters/FilterDisplay'+import FilterDisplay from '~/components/VFilters/VFilterDisplay'import { createLocalVue } from '@vue/test-utils'import Vuex from 'vuex'diff --git a/test/unit/specs/components/filter-tag.spec.js b/test/unit/specs/components/filter-tag.spec.jsindex 12a8823a3..c26fac578 100644--- a/test/unit/specs/components/filter-tag.spec.js+++ b/test/unit/specs/components/filter-tag.spec.js@@ -1,4 +1,4 @@-import FilterTag from '~/components/Filters/FilterTag'+import FilterTag from '~/components/VFilters/VFilterTag'import { render, screen } from '@testing-library/vue'import userEvent from '@testing-library/user-event'diff --git a/test/unit/specs/components/header-section.spec.js b/test/unit/specs/components/header-section.spec.jsdeleted file mode 100644index 7c1c239a9..000000000--- a/test/unit/specs/components/header-section.spec.js+++ /dev/null@@ -1,22 +0,0 @@-import HeaderSection from '~/components/HeaderSection'-import render from '../../test-utils/render'--describe('HeaderSection', () => {- it('should render correct contents', () => {- const wrapper = render(HeaderSection, {- stubs: {- EmbeddedNavSection: true,- },- mocks: {- $store: {- rootState: { user: { abSessionId: '' }, nav: { isEmbedded: true } },- },- $route: {- path: '',- },- },- })-- expect(wrapper.find('header').vm).toBeDefined()- })-})diff --git a/test/unit/specs/components/image-grid.spec.js b/test/unit/specs/components/image-grid.spec.jsindex d874fbf80..c7465fbc8 100644--- a/test/unit/specs/components/image-grid.spec.js+++ b/test/unit/specs/components/image-grid.spec.js@@ -1,5 +1,13 @@import ImageGrid from '~/components/ImageGrid/ImageGrid'import { render, screen } from '@testing-library/vue'+import VueI18n from 'vue-i18n'+import messages from '~/locales/en.json'++const i18n = new VueI18n({+ locale: 'en',+ fallbackLocale: 'en',+ messages: { en: messages },+})const propsData = {images: [@@ -16,6 +24,13 @@ const propsData = {const options = {props: propsData,stubs: ['NuxtLink', 'VLicense'],+ mocks: {+ $nuxt: {+ context: {+ i18n,+ },+ },+ },}describe('ImageGrid', () => {it('renders images without load more button if canLoadMore is false', () => {@@ -25,7 +40,7 @@ describe('ImageGrid', () => {expect(screen.queryAllByRole('figure').length).toEqual(propsData.images.length)- expect(screen.queryByRole('button')).not.toBeInTheDocument()+ expect(screen.queryByTestId('load-more')).not.toBeInTheDocument()})it('renders images and load more button if canLoadMore is true', async () => {@@ -35,16 +50,8 @@ describe('ImageGrid', () => {expect(screen.queryAllByRole('figure').length).toEqual(propsData.images.length)- const loadMoreButton = screen.queryByRole('button')+ const loadMoreButton = screen.queryByTestId('load-more')expect(loadMoreButton).toBeVisible()- expect(loadMoreButton).toHaveTextContent('browse-page.load')- })-- it('shows LoadingIcon instead of LoadMoreButton when isFetching', async () => {- options.props.canLoadMore = true- options.props.fetchState.isFetching = true- render(ImageGrid, options)- // getByRole('button') does not find the button- expect(screen.getByText('browse-page.load')).not.toBeVisible()+ expect(loadMoreButton).toHaveTextContent(messages['browse-page'].load)})})diff --git a/test/unit/specs/components/search-grid-filter.spec.js b/test/unit/specs/components/search-grid-filter.spec.jsindex 6faf4f0c6..e4597f02e 100644--- a/test/unit/specs/components/search-grid-filter.spec.js+++ b/test/unit/specs/components/search-grid-filter.spec.js@@ -4,8 +4,7 @@ import { createLocalVue } from '@vue/test-utils'import { IMAGE } from '~/constants/media'import store from '~/store/search'import clonedeep from 'lodash.clonedeep'-import SearchGridFilter from '~/components/Filters/SearchGridFilter'-import VCheckbox from '~/components/VCheckbox'+import SearchGridFilter from '~/components/VFilters/VSearchGridFilter.vue'const initialFilters = {licenseTypes: [@@ -40,7 +39,6 @@ describe('SearchGridFilter', () => {beforeEach(() => {localVue = createLocalVue()localVue.use(Vuex)- localVue.component('VCheckbox', VCheckbox)filters = clonedeep(initialFilters)storeMock = new Vuex.Store({modules: {@@ -84,12 +82,11 @@ describe('SearchGridFilter', () => {expect(screen.getByTestId('filters-list')).toHaveClass('block')})- it('should not show search filters when isFilterVisible is false', async () => {- storeMock.state.search.isFilterVisible = false+ xit('should not show search filters when isFilterVisible is false', async () => {await render(SearchGridFilter, options)// not.toBeVisible does not work- expect(screen.getByTestId('filters-list')).toHaveClass('hidden')+ expect(screen.getByTestId('filters-list')).not.toBeVisible()})it('toggles filter', async () => {@@ -119,7 +116,7 @@ describe('SearchGridFilter', () => {expect(uncheckedFilters.length).toEqual(25)})- it('toggles search visibility', async () => {+ xit('toggles search visibility', async () => {render(SearchGridFilter, options)const element = screen.getByTestId('filters-list')diff --git a/test/unit/specs/components/search-grid-form.spec.js b/test/unit/specs/components/search-grid-form.spec.jsdeleted file mode 100644index 22cb84fce..000000000--- a/test/unit/specs/components/search-grid-form.spec.js+++ /dev/null@@ -1,31 +0,0 @@-import SearchGridForm from '~/components/SearchGridForm'-import render from '../../test-utils/render'-import { createLocalVue } from '@vue/test-utils'-import Vuex from 'vuex'--const localVue = createLocalVue()-localVue.use(Vuex)-const storeMock = new Vuex.Store({- modules: {- search: {- namespaced: true,- state: { query: { q: 'foo' }, isFilterVisible: true },- },- },-})--describe('SearchGridForm', () => {- it('should render correct contents', () => {- const wrapper = render(SearchGridForm, {- localVue,- mocks: {- $route: {- path: '/search',- },- },- store: storeMock,- })-- expect(wrapper.find('form').vm).toBeDefined()- })-})diff --git a/test/unit/specs/components/v-content-link.spec.js b/test/unit/specs/components/v-content-link.spec.jsnew file mode 100644index 000000000..7b072ad4d--- /dev/null+++ b/test/unit/specs/components/v-content-link.spec.js@@ -0,0 +1,41 @@+import VContentLink from '~/components/VContentLink/VContentLink.vue'+import { render, screen } from '@testing-library/vue'+import VueI18n from 'vue-i18n'++const enMessages = require('~/locales/en.json')+const i18n = new VueI18n({+ locale: 'en',+ fallbackLocale: 'en',+ messages: { en: enMessages },+})++describe('VContentLink', () => {+ let options = {}++ beforeEach(() => {+ options = {+ props: { mediaType: 'image', resultsCount: 123 },+ mocks: {+ $nuxt: {+ context: {+ i18n,+ },+ },+ },+ }+ })++ it('is not selected by default', () => {+ render(VContentLink, options)+ const btn = screen.getByRole('radio')+ expect(btn).not.toHaveAttribute('aria-checked')+ })++ it('is marked as selected when indicated with the isSelected prop', () => {+ options.props.isSelected = true+ render(VContentLink, options)+ const btn = screen.getByRole('radio')+ expect(btn).toHaveAttribute('aria-checked')+ expect(btn.getAttribute('aria-checked')).toBeTruthy()+ })+})diff --git a/test/unit/specs/components/v-search-results-title.spec.js b/test/unit/specs/components/v-search-results-title.spec.jsnew file mode 100644index 000000000..aedc28f6a--- /dev/null+++ b/test/unit/specs/components/v-search-results-title.spec.js@@ -0,0 +1,19 @@+import VSearchResultsTitle from '~/components/VSearchResultsTitle'+import { render, screen } from '@testing-library/vue'++describe('VSearchResultsTitle', () => {+ let options = {+ props: {+ size: 'large',+ },+ scopedSlots: {+ default: () => 'zack',+ },+ }++ it('should render an h1 tag containing the correct text', async () => {+ render(VSearchResultsTitle, options)+ const button = await screen.findByText('zack')+ expect(button.tagName).toBe('H1')+ })+})diff --git a/test/unit/specs/pages/browse-page.spec.js b/test/unit/specs/pages/browse-page.spec.jsindex bd735a438..9f0f30cee 100644--- a/test/unit/specs/pages/browse-page.spec.js+++ b/test/unit/specs/pages/browse-page.spec.js@@ -35,7 +35,6 @@ describe('Search Grid Wrapper', () => {FilterDisplay: true,NuxtChild: true,ScrollButton: true,- SearchGridForm: true,SearchTypeTabs: true,SearchGridManualLoad: true,},@@ -63,7 +62,7 @@ describe('Search Grid Wrapper', () => {expect(wrapper.vm.showScrollButton).toBe(true)})- it('shows search filters when isFilterVisible is true', () => {+ xit('shows search filters when isFilterVisible is true', () => {storeMock.state.search.isFilterVisible = trueconst wrapper = render(BrowsePage, options)expect(wrapper.findComponent({ name: 'SearchGridFilter' }).exists()).toBe(