Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Update metasearch button style and use a modal for screens below `lg` (#2811)
Chenika Bukesd245b5ab5d42
diff --git a/frontend/src/components/VExternalSearch/VExternalSearchForm.vue b/frontend/src/components/VExternalSearch/VExternalSearchForm.vueindex e9a8755fc..700810d29 100644--- a/frontend/src/components/VExternalSearch/VExternalSearchForm.vue+++ b/frontend/src/components/VExternalSearch/VExternalSearchForm.vue@@ -2,57 +2,34 @@<section:key="externalSourcesType"ref="sectionRef"- class="external-sources flex flex-row place-items-center justify-center py-4"+ class="external-sources flex flex-row place-items-center justify-center pb-6 pt-4 lg:pb-10"data-testid="external-sources-form">- <i18n- v-if="!hasNoResults && isSupported"- path="externalSources.form.supportedTitle"- tag="p"- class="description-regular"- />-- <i18n- v-else-if="!hasNoResults && !isSupported"- path="externalSources.form.unsupportedTitle"- tag="p"- class="description-regular"- >- <template #openverse>Openverse</template>- <template #type>{{- $t(`externalSources.form.types.${externalSourcesType}`)- }}</template>- </i18n>-- <i18n- v-else- path="externalSources.form.noResultsTitle"- tag="p"- class="description-regular"- >- <template #type>{{- $t(`externalSources.form.types.${externalSourcesType}`)- }}</template>- <template #query>{{ searchTerm }}</template>- </i18n>-<VModalvariant="centered":hide-on-click-outside="true"labelled-by="external-sources-button"+ class="w-full"@open="handleModalOpen"><template #trigger="triggerA11yProps"><VButtonid="external-sources-button"- v-bind="triggerA11yProps"+ ref="triggerRef"+ :pressed="triggerA11yProps['aria-expanded']"+ aria-haspopup="dialog"aria-controls="external-sources-modal"- variant="dropdown-label"+ variant="bordered-gray"size="disabled"- class="caption-regular ms-2 min-w-max gap-1 px-3 py-1 pe-1 text-dark-charcoal focus-visible:border-tx"- >{{ `${$t("externalSources.button")}`- }}<VIcon- class="text-dark-charcoal-40"+ class="label-bold lg:description-bold h-16 w-full gap-x-2 lg:h-18"+ >+ <i18n+ v-if="isMd"+ path="externalSources.form.supportedTitle"+ tag="p"+ />+ <i18n v-else path="externalSources.form.supportedTitleSm" tag="p" />+ <VIcon:class="{ 'text-white': triggerA11yProps['aria-expanded'] }"name="caret-down"/>@@ -80,12 +57,13 @@</template><script lang="ts">-import { defineComponent, ref } from "vue"+import { computed, defineComponent, ref } from "vue"import { storeToRefs } from "pinia"import { defineEvent } from "~/types/emits"+import { useUiStore } from "~/stores/ui"import { useSearchStore } from "~/stores/search"import { useMediaStore } from "~/stores/media"@@ -127,6 +105,8 @@ export default defineComponent({setup() {const sectionRef = ref<HTMLElement | null>(null)const searchStore = useSearchStore()+ const uiStore = useUiStore()+const { sendCustomEvent } = useAnalytics()const mediaStore = useMediaStore()@@ -142,9 +122,12 @@ export default defineComponent({const { externalSourcesType } = useExternalSources()+ const isMd = computed(() => uiStore.isBreakpoint("md"))+return {externalSourcesType,sectionRef,+ isMd,handleModalOpen,}diff --git a/frontend/src/components/VSearchResultsGrid/VAudioCollection.vue b/frontend/src/components/VSearchResultsGrid/VAudioCollection.vueindex 8aabdf62f..633fe543d 100644--- a/frontend/src/components/VSearchResultsGrid/VAudioCollection.vue+++ b/frontend/src/components/VSearchResultsGrid/VAudioCollection.vue@@ -21,7 +21,7 @@:is-related="isRelated":results="results"/>- <footer v-if="!isRelated">+ <footer v-if="!isRelated" class="mt-4"><VLoadMore /></footer></section>diff --git a/frontend/src/composables/use-body-scroll-lock.ts b/frontend/src/composables/use-body-scroll-lock.tsindex db02f1566..0429eedb5 100644--- a/frontend/src/composables/use-body-scroll-lock.ts+++ b/frontend/src/composables/use-body-scroll-lock.ts@@ -34,6 +34,8 @@ export function useBodyScrollLock({scrollY = window.scrollYdocument.body.style.position = "fixed"document.body.style.top = `-${scrollY}px`+ document.body.style.right = "0"+ document.body.style.left = "0"}const unlock = () => {@@ -45,6 +47,8 @@ export function useBodyScrollLock({const document = getDocument(nodeRef.value)document.body.style.position = ""document.body.style.top = ""+ document.body.style.right = ""+ document.body.style.left = ""if (scrollY) {window.scrollTo(0, scrollY)scrollY = nulldiff --git a/frontend/src/locales/scripts/en.json5 b/frontend/src/locales/scripts/en.json5index 3547936cd..134ef55ea 100644--- a/frontend/src/locales/scripts/en.json5+++ b/frontend/src/locales/scripts/en.json5@@ -587,7 +587,8 @@},form: {unsupportedTitle: "{openverse} does not yet support built-in {type} search.",- supportedTitle: "Not finding what you're looking for? Try an external source:",+ supportedTitle: "Not finding what you're looking for? Search in external sources",+ supportedTitleSm: "Search in external sources",noResultsTitle: 'No {type} results for "{query}".',caption: "Click on a source below to directly search other collections of CC-licensed {type}.",types: {diff --git a/frontend/test/locales/ar.json b/frontend/test/locales/ar.jsonindex 3b8dbe3a7..6a8d7afdd 100644--- a/frontend/test/locales/ar.json+++ b/frontend/test/locales/ar.json@@ -134,7 +134,8 @@},"form": {"unsupportedTitle": "{openverse} لا يدعم حتى الآن البحث المضمن {type}.",- "supportedTitle": "لا تجد ما تبحث عنه؟ جرب مصدر خارجي:",+ "supportedTitle": "لا تجد ما تبحث عنه؟ ابحث في مصادر خارجية",+ "supportedTitleSm": "ابحث في مصادر خارجية","noResultsTitle": "لا توجد نتائج {type} لـ \"{query}\".","caption": "انقر فوق أحد المصادر أدناه للبحث مباشرة في مجموعات أخرى من {type} المرخصة CC.","typesPlural": {diff --git a/frontend/test/playwright/e2e/external-sources.spec.ts b/frontend/test/playwright/e2e/external-sources.spec.tsindex 077383fa6..44ff86cad 100644--- a/frontend/test/playwright/e2e/external-sources.spec.ts+++ b/frontend/test/playwright/e2e/external-sources.spec.ts@@ -15,7 +15,9 @@ test("sends VIEW_EXTERNAL_SOURCES analytics events", async ({await goToSearchTerm(page, "cat", { searchType: "image", mode: "SSR" })- await page.getByRole("button", { name: t("externalSources.button") }).click()+ await page+ .getByRole("button", { name: t("externalSources.form.supportedTitle") })+ .click()await page.getByRole("button", { name: /close/i }).click()const viewEvent = events.find((event) => event.n === "VIEW_EXTERNAL_SOURCES")@@ -37,7 +39,11 @@ test("sends SELECT_EXTERNAL_SOURCE analytics events", async ({await goToSearchTerm(page, "cat", { searchType: "image", mode: "SSR" })- await page.getByRole("button", { name: t("externalSources.button") }).click()+ await page+ .getByRole("button", {+ name: new RegExp(t("externalSources.form.supportedTitleSm"), "i"),+ })+ .click()await page.getByRole("link", { name: "Centre for Ageing Better" }).click()const newPage = await pagePromisediff --git a/frontend/test/playwright/visual-regression/components/external-sources-section.spec.ts b/frontend/test/playwright/visual-regression/components/external-sources-section.spec.tsindex 8abb81a81..ad07a95d7 100644--- a/frontend/test/playwright/visual-regression/components/external-sources-section.spec.ts+++ b/frontend/test/playwright/visual-regression/components/external-sources-section.spec.ts@@ -21,7 +21,10 @@ for (const dir of languageDirections) {await goToSearchTerm(page, "birds", { searchType: mediaType, dir })const externalSourcesButton = page.getByRole("button", {- name: t("externalSources.button", dir),+ name: new RegExp(+ t("externalSources.form.supportedTitleSm", dir),+ "i"+ ),})await page