This repository has been archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
External sources on no results page (#2077)
* Use buttons for external sources links on the No results page * Add VR tests * Update src/components/VErrorSection/VNoResults.vue * Add changes from code review * Update snapshots
- Loading branch information
Showing
46 changed files
with
154 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,56 @@ | ||
<template> | ||
<div class="no-results text-center md:text-left"> | ||
<h1 class="break-words text-4xl md:text-6xl"> | ||
{{ $t("no-results.heading", { query: query.q }) }} | ||
<h1 class="heading-4 md:heading-2 break-words"> | ||
{{ $t("no-results.heading", { query: searchTerm }) }} | ||
</h1> | ||
<h2 | ||
class="mt-10 text-base font-normal md:mt-16 md:text-3xl md:font-semibold" | ||
> | ||
<h2 class="description-regular md:heading-5 mt-4"> | ||
{{ $t("no-results.alternatives") }} | ||
</h2> | ||
<VExternalSourceList class="mt-4 md:mt-6" :type="type" :query="query" /> | ||
|
||
<div class="mt-10 flex flex-col flex-wrap gap-4 gap-2 md:flex-row"> | ||
<VButton | ||
v-for="source in externalSources" | ||
:key="source.name" | ||
as="VLink" | ||
:href="source.url" | ||
variant="secondary-bordered" | ||
class="label-bold justify-between text-dark-charcoal md:justify-start md:gap-x-2" | ||
> | ||
{{ source.name }} | ||
<VIcon :icon-path="externalLinkIcon" :size="4" rtl-flip /> | ||
</VButton> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent, PropType } from "@nuxtjs/composition-api" | ||
import type { MediaType } from "~/constants/media" | ||
import type { ApiQueryParams } from "~/utils/search-query-transform" | ||
import type { ExternalSource } from "~/types/external-source" | ||
import VButton from "~/components/VButton.vue" | ||
import VExternalSourceList from "~/components/VExternalSearch/VExternalSourceList.vue" | ||
import VIcon from "~/components/VIcon/VIcon.vue" | ||
import externalLinkIcon from "~/assets/icons/external-link.svg" | ||
export default defineComponent({ | ||
name: "VNoResults", | ||
components: { VExternalSourceList }, | ||
components: { VIcon, VButton }, | ||
props: { | ||
type: { | ||
type: String as PropType<MediaType>, | ||
externalSources: { | ||
type: Array as PropType<ExternalSource[]>, | ||
required: true, | ||
}, | ||
query: { | ||
type: Object as PropType<ApiQueryParams>, | ||
searchTerm: { | ||
type: String, | ||
required: true, | ||
}, | ||
}, | ||
setup() { | ||
return { | ||
externalLinkIcon, | ||
} | ||
}, | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export interface ExternalSource { | ||
name: string | ||
url: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
test/playwright/visual-regression/pages/no-results.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { test } from "@playwright/test" | ||
|
||
import { | ||
enableNewHeader, | ||
goToSearchTerm, | ||
languageDirections, | ||
setCookies, | ||
} from "~~/test/playwright/utils/navigation" | ||
import breakpoints from "~~/test/playwright/utils/breakpoints" | ||
|
||
import { supportedSearchTypes } from "~/constants/media" | ||
|
||
test.describe.configure({ mode: "parallel" }) | ||
|
||
for (const searchType of supportedSearchTypes) { | ||
for (const dir of languageDirections) { | ||
breakpoints.describeEvery(({ breakpoint, expectSnapshot }) => { | ||
test(`No results ${searchType} ${dir} page snapshots`, async ({ | ||
page, | ||
}) => { | ||
await enableNewHeader(page) | ||
await setCookies(page.context(), { | ||
uiBreakpoint: breakpoint as string, | ||
uiIsFilterDismissed: true, | ||
uiDismissedBanners: ["translation-ar"], | ||
}) | ||
await goToSearchTerm(page, "querywithnoresults", { dir, searchType }) | ||
|
||
await expectSnapshot(`no-results-${searchType}-${dir}`, page, { | ||
fullPage: true, | ||
}) | ||
}) | ||
}) | ||
} | ||
} |
Binary file added
BIN
+450 KB
...-regression/pages/no-results.spec.ts-snapshots/no-results-all-ltr-2xl-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+265 KB
...l-regression/pages/no-results.spec.ts-snapshots/no-results-all-ltr-lg-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+130 KB
...l-regression/pages/no-results.spec.ts-snapshots/no-results-all-ltr-md-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+45.7 KB
...l-regression/pages/no-results.spec.ts-snapshots/no-results-all-ltr-sm-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+392 KB
...l-regression/pages/no-results.spec.ts-snapshots/no-results-all-ltr-xl-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+45.5 KB
...l-regression/pages/no-results.spec.ts-snapshots/no-results-all-ltr-xs-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+447 KB
...-regression/pages/no-results.spec.ts-snapshots/no-results-all-rtl-2xl-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+261 KB
...l-regression/pages/no-results.spec.ts-snapshots/no-results-all-rtl-lg-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+123 KB
...l-regression/pages/no-results.spec.ts-snapshots/no-results-all-rtl-md-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+42.2 KB
...l-regression/pages/no-results.spec.ts-snapshots/no-results-all-rtl-sm-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+388 KB
...l-regression/pages/no-results.spec.ts-snapshots/no-results-all-rtl-xl-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+41.4 KB
...l-regression/pages/no-results.spec.ts-snapshots/no-results-all-rtl-xs-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+444 KB
...egression/pages/no-results.spec.ts-snapshots/no-results-audio-ltr-2xl-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+364 KB
...regression/pages/no-results.spec.ts-snapshots/no-results-audio-ltr-lg-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+122 KB
...regression/pages/no-results.spec.ts-snapshots/no-results-audio-ltr-md-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+35.8 KB
...regression/pages/no-results.spec.ts-snapshots/no-results-audio-ltr-sm-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+438 KB
...regression/pages/no-results.spec.ts-snapshots/no-results-audio-ltr-xl-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+36 KB
...regression/pages/no-results.spec.ts-snapshots/no-results-audio-ltr-xs-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+439 KB
...egression/pages/no-results.spec.ts-snapshots/no-results-audio-rtl-2xl-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+338 KB
...regression/pages/no-results.spec.ts-snapshots/no-results-audio-rtl-lg-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+115 KB
...regression/pages/no-results.spec.ts-snapshots/no-results-audio-rtl-md-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+32.1 KB
...regression/pages/no-results.spec.ts-snapshots/no-results-audio-rtl-sm-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+433 KB
...regression/pages/no-results.spec.ts-snapshots/no-results-audio-rtl-xl-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+31.7 KB
...regression/pages/no-results.spec.ts-snapshots/no-results-audio-rtl-xs-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+450 KB
...egression/pages/no-results.spec.ts-snapshots/no-results-image-ltr-2xl-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+265 KB
...regression/pages/no-results.spec.ts-snapshots/no-results-image-ltr-lg-linux.png
Oops, something went wrong.
Binary file added
BIN
+130 KB
...regression/pages/no-results.spec.ts-snapshots/no-results-image-ltr-md-linux.png
Oops, something went wrong.
Binary file added
BIN
+45.7 KB
...regression/pages/no-results.spec.ts-snapshots/no-results-image-ltr-sm-linux.png
Oops, something went wrong.
Binary file added
BIN
+392 KB
...regression/pages/no-results.spec.ts-snapshots/no-results-image-ltr-xl-linux.png
Oops, something went wrong.
Binary file added
BIN
+45.5 KB
...regression/pages/no-results.spec.ts-snapshots/no-results-image-ltr-xs-linux.png
Oops, something went wrong.
Binary file added
BIN
+447 KB
...egression/pages/no-results.spec.ts-snapshots/no-results-image-rtl-2xl-linux.png
Oops, something went wrong.
Binary file added
BIN
+261 KB
...regression/pages/no-results.spec.ts-snapshots/no-results-image-rtl-lg-linux.png
Oops, something went wrong.
Binary file added
BIN
+123 KB
...regression/pages/no-results.spec.ts-snapshots/no-results-image-rtl-md-linux.png
Oops, something went wrong.
Binary file added
BIN
+42.2 KB
...regression/pages/no-results.spec.ts-snapshots/no-results-image-rtl-sm-linux.png
Oops, something went wrong.
Binary file added
BIN
+388 KB
...regression/pages/no-results.spec.ts-snapshots/no-results-image-rtl-xl-linux.png
Oops, something went wrong.
Binary file added
BIN
+41.4 KB
...regression/pages/no-results.spec.ts-snapshots/no-results-image-rtl-xs-linux.png
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters