Skip to content

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

Converge `NavSection` components (#454)

Dhruv Bhanushali8a19841f000d
diff --git a/src/components/Dropdown.vue b/src/components/Dropdown.vue
index 072b200a9..d34db1e8c 100644
--- a/src/components/Dropdown.vue
+++ b/src/components/Dropdown.vue
@@ -29,7 +29,7 @@
:class="{ visible: isHovered || isFocused }"
role="menu"
>
- <slot :onFocus="onFocus" />
+ <slot :onFocus="onFocus" :a11y-props="{ role: 'menuitem' }" />
</div>
</div>
</template>
diff --git a/src/components/EmbeddedNavSection.vue b/src/components/EmbeddedNavSection.vue
deleted file mode 100644
index 2ea564c2d..000000000
--- a/src/components/EmbeddedNavSection.vue
+++ /dev/null
@@ -1,188 +0,0 @@
-<template>
- <!-- Refer to the Bulma docs for markup: https://bulma.io/documentation/components/navbar/ -->
- <nav
- role="navigation"
- class="navbar embedded"
- :aria-label="$t('header.aria.primary')"
- >
- <div class="navbar-brand flex-grow md:flex-grow-0">
- <NuxtLink
- to="/"
- class="navbar-item"
- style="align-self: center; line-height: 0"
- >
- <!-- width and height chosen w.r.t. viewBox "0 0 280 42" -->
- <OpenverseLogo
- :style="{ width: '160px', height: '24px' }"
- alt="Openverse logo mark"
- />
- </NuxtLink>
-
- <!-- Hamburger menu -->
- <a
- role="button"
- class="navbar-burger"
- :class="{ 'is-active': isBurgerMenuActive }"
- :aria-label="$t('header.aria.menu')"
- aria-expanded="false"
- @click="toggleBurgerActive"
- @keyup.enter="toggleBurgerActive"
- >
- <span v-for="i in 3" :key="i" aria-hidden="true" />
- </a>
- </div>
-
- <div class="navbar-menu" :class="{ 'is-active': isBurgerMenuActive }">
- <div class="navbar-start">
- <form
- v-if="showNavSearch"
- class="navbar-item flex items-center"
- role="search"
- method="post"
- @submit.prevent="onSubmit"
- >
- <input
- v-model.lazy="form.searchTerm"
- :aria-label="$t('header.aria.search')"
- class="input w-64"
- type="search"
- :placeholder="navSearchPlaceholder"
- />
- <div class="sr-only">
- <button
- :aria-label="$t('header.aria.sr-search')"
- tabindex="-1"
- type="submit"
- class="button secondary"
- value="Search"
- />
- </div>
- </form>
- </div>
-
- <div class="navbar-end">
- <Dropdown v-slot="{ onFocus }" :text="$t('header.about-tab')">
- <NuxtLink
- class="navbar-item"
- :to="localePath('/about')"
- role="menuitem"
- @focus="onFocus()"
- >
- {{ $t('header.about-nav-item') }}
- </NuxtLink>
- <NuxtLink
- class="navbar-item"
- :to="localePath('/sources')"
- role="menuitem"
- @focus="onFocus()"
- >
- {{ $t('header.source-nav-item') }}
- </NuxtLink>
- <a
- href="https://creativecommons.org/about/cclicenses/"
- target="_blank"
- rel="noopener"
- class="navbar-item"
- role="menuitem"
- @focus="onFocus()"
- >{{ $t('header.licenses-nav-item') }}
- <VIcon class="inline ms-2" :icon-path="externalLinkIcon" rtl-flip />
- </a>
- </Dropdown>
-
- <Dropdown v-slot="{ onFocus }" :text="$t('header.resources-tab')">
- <NuxtLink
- class="navbar-item"
- :to="localePath('/search-help')"
- role="menuitem"
- @focus="onFocus()"
- >
- {{ $t('header.search-guide-nav-item') }}
- </NuxtLink>
- <NuxtLink
- class="navbar-item"
- :to="localePath('/meta-search')"
- role="menuitem"
- @focus="onFocus()"
- >
- {{ $t('header.meta-search-nav-item') }}
- </NuxtLink>
- <NuxtLink
- class="navbar-item"
- :to="localePath('/feedback')"
- role="menuitem"
- @focus="onFocus()"
- >
- {{ $t('header.feedback-nav-item') }}
- </NuxtLink>
- <a
- href="https://api.openverse.engineering/v1/"
- target="_blank"
- rel="noopener"
- role="menuitem"
- class="navbar-item"
- @focus="onFocus()"
- >{{ $t('header.api-nav-item') }}
- <VIcon class="inline ms-2" :icon-path="externalLinkIcon" rtl-flip />
- </a>
- </Dropdown>
-
- <NuxtLink class="navbar-item" :to="localePath('/extension')">
- {{ $t('header.extension-nav-item') }}
- </NuxtLink>
- </div>
- </div>
- </nav>
-</template>
-
-<script>
-import { mapActions } from 'vuex'
-
-import Dropdown from '~/components/Dropdown'
-import VIcon from '~/components/VIcon/VIcon.vue'
-
-import { UPDATE_QUERY } from '~/constants/action-types'
-import { SEARCH } from '~/constants/store-modules'
-
-import OpenverseLogo from '~/assets/logo.svg?inline'
-import externalLinkIcon from '~/assets/icons/external-link.svg'
-
-export default {
- name: 'EmbeddedNavSection',
- components: {
- VIcon,
- Dropdown,
- OpenverseLogo,
- },
- props: {
- showNavSearch: {
- default: false,
- },
- },
- data: () => ({
- form: { searchTerm: '' },
- isBurgerMenuActive: false,
- externalLinkIcon,
- }),
- computed: {
- navSearchPlaceholder() {
- return this.$t('header.placeholder')
- },
- },
- methods: {
- ...mapActions(SEARCH, { setSearchTerm: UPDATE_QUERY }),
- onSubmit() {
- const q = this.form.searchTerm
- this.setSearchTerm({ q })
- const newPath = this.localePath({
- path: '/search',
- query: { q },
- })
- this.$router.push(newPath)
- },
- toggleBurgerActive() {
- this.isBurgerMenuActive = !this.isBurgerMenuActive
- },
- },
-}
-</script>
diff --git a/src/components/HeaderSection.vue b/src/components/HeaderSection.vue
index 551bf1b55..ffa59d24e 100644
--- a/src/components/HeaderSection.vue
+++ b/src/components/HeaderSection.vue
@@ -1,11 +1,6 @@
<template>
- <header :class="{ embedded: isEmbedded }">
- <EmbeddedNavSection
- v-if="isEmbedded"
- :key="$route.path"
- :show-nav-search="showNavSearch"
- />
- <NavSection v-else :key="$route.path" :show-nav-search="showNavSearch" />
+ <header class="embedded">
+ <NavSection :key="$route.path" :show-nav-search="showNavSearch" />
<NotificationBanner v-if="showNotification" />
</header>
</template>
@@ -14,7 +9,6 @@
export default {
name: 'HeaderSection',
props: {
- isEmbedded: { type: Boolean, default: true },
showNavSearch: { type: Boolean, default: false },
showNotification: { type: Boolean, default: false },
},
diff --git a/src/components/NavSection.vue b/src/components/NavSection.vue
index d0afe94d4..66f171a6c 100644
--- a/src/components/NavSection.vue
+++ b/src/components/NavSection.vue
@@ -1,34 +1,39 @@
<template>
- <nav :aria-label="$t('header.aria.primary')" class="navbar">
- <div class="navbar-brand text-white">
- <!-- eslint-disable @intlify/vue-i18n/no-raw-text -->
- <NuxtLink class="logo" :to="localePath('/')">
- <img
- alt="Openverse logo mark"
- src="~/assets/logo.svg?data"
- style="padding-right: 24px"
- width="160"
- height="24"
- />
+ <!-- Refer to the Bulma docs for markup: https://bulma.io/documentation/components/navbar/ -->
+ <nav
+ role="navigation"
+ class="navbar embedded"
+ :aria-label="$t('header.aria.primary')"
+ >
+ <div class="navbar-brand flex-grow md:flex-grow-0">
+ <NuxtLink
+ to="/"
+ class="navbar-item"
+ style="align-self: center; line-height: 0"
+ >
+ <!-- width and height chosen w.r.t. viewBox "0 0 280 42" -->
+ <OpenverseLogo width="160" height="24" alt="Openverse logo" />
</NuxtLink>
- <!-- eslint-enable -->
+
+ <!-- Hamburger menu -->
<a
role="button"
- :class="{ ['navbar-burger']: true, ['is-active']: isBurgerMenuActive }"
+ class="navbar-burger"
+ :class="{ 'is-active': isBurgerMenuActive }"
:aria-label="$t('header.aria.menu')"
aria-expanded="false"
@click="toggleBurgerActive"
@keyup.enter="toggleBurgerActive"
>
- <span aria-hidden="true" />
- <span aria-hidden="true" />
- <span aria-hidden="true" />
+ <span v-for="i in 3" :key="i" aria-hidden="true" />
</a>
</div>
- <div :class="{ ['navbar-menu']: true, ['is-active']: isBurgerMenuActive }">
- <div v-if="showNavSearch" class="ms-6">
+
+ <div class="navbar-menu" :class="{ 'is-active': isBurgerMenuActive }">
+ <div class="navbar-start">
<form
- class="hero_search-form"
+ v-if="showNavSearch"
+ class="search-form navbar-item flex items-center"
role="search"
method="post"
@submit.prevent="onSubmit"
@@ -36,7 +41,7 @@
<input
v-model.lazy="form.searchTerm"
:aria-label="$t('header.aria.search')"
- class="input"
+ class="input w-64"
type="search"
:placeholder="navSearchPlaceholder"
/>
@@ -51,11 +56,16 @@
</div>
</form>
</div>
+
<div class="navbar-end">
- <Dropdown v-slot="{ onFocus }" :text="$t('header.about-tab')">
+ <Dropdown
+ v-slot="{ onFocus, a11yProps }"
+ :text="$t('header.about-tab')"
+ >
<NuxtLink
class="navbar-item"
:to="localePath('/about')"
+ v-bind="a11yProps"
@focus="onFocus()"
>
{{ $t('header.about-nav-item') }}
@@ -63,6 +73,7 @@
<NuxtLink
class="navbar-item"
:to="localePath('/sources')"
+ v-bind="a11yProps"
@focus="onFocus()"
>
{{ $t('header.source-nav-item') }}
@@ -72,16 +83,21 @@
target="_blank"
rel="noopener"
class="navbar-item"
+ v-bind="a11yProps"
@focus="onFocus()"
>{{ $t('header.licenses-nav-item') }}
- <i class="icon external-link" />
+ <VIcon class="inline ms-2" :icon-path="externalLinkIcon" rtl-flip />
</a>
</Dropdown>
- <Dropdown v-slot="{ onFocus }" :text="$t('header.resources-tab')">
+ <Dropdown
+ v-slot="{ onFocus, a11yProps }"
+ :text="$t('header.resources-tab')"
+ >
<NuxtLink
class="navbar-item"
:to="localePath('/search-help')"
+ v-bind="a11yProps"
@focus="onFocus()"
>
{{ $t('header.search-guide-nav-item') }}
@@ -89,6 +105,7 @@
<NuxtLink
class="navbar-item"
:to="localePath('/meta-search')"
+ v-bind="a11yProps"
@focus="onFocus()"
>
{{ $t('header.meta-search-nav-item') }}
@@ -96,6 +113,7 @@
<NuxtLink
class="navbar-item"
:to="localePath('/feedback')"
+ v-bind="a11yProps"
@focus="onFocus()"
>
{{ $t('header.feedback-nav-item') }}
@@ -104,41 +122,51 @@
href="https://api.openverse.engineering/v1/"
target="_blank"
rel="noopener"
+ v-bind="a11yProps"
class="navbar-item"
@focus="onFocus()"
>{{ $t('header.api-nav-item') }}
- <i class="icon external-link" />
+ <VIcon class="inline ms-2" :icon-path="externalLinkIcon" rtl-flip />
</a>
</Dropdown>
- <a
- class="navbar-item"
- href="https://opensource.creativecommons.org/ccsearch-browser-extension/"
- target="_blank"
- >
+ <NuxtLink class="navbar-item" :to="localePath('/extension')">
{{ $t('header.extension-nav-item') }}
- <i class="icon external-link" />
- </a>
+ </NuxtLink>
</div>
</div>
</nav>
</template>
<script>
-import { UPDATE_QUERY } from '~/constants/action-types'
+import { mapActions } from 'vuex'
+
import Dropdown from '~/components/Dropdown'
+import VIcon from '~/components/VIcon/VIcon.vue'
+
+import { UPDATE_QUERY } from '~/constants/action-types'
import { SEARCH } from '~/constants/store-modules'
-import { mapActions } from 'vuex'
+
+import OpenverseLogo from '~/assets/logo.svg?inline'
+import externalLinkIcon from '~/assets/icons/external-link.svg'
export default {
- name: 'NavSection',
- components: { Dropdown },
+ name: 'EmbeddedNavSection',
+ components: {
+ VIcon,
+ Dropdown,
+ OpenverseLogo,
+ },
props: {
showNavSearch: {
default: false,
},
},
- data: () => ({ form: { searchTerm: '' }, isBurgerMenuActive: false }),
+ data: () => ({
+ form: { searchTerm: '' },
+ isBurgerMenuActive: false,
+ externalLinkIcon,
+ }),
computed: {
navSearchPlaceholder() {
return this.$t('header.placeholder')
@@ -147,10 +175,11 @@ export default {
methods: {
...mapActions(SEARCH, { setSearchTerm: UPDATE_QUERY }),
onSubmit() {
- this.setSearchTerm({ q: this.form.searchTerm })
+ const q = this.form.searchTerm
+ this.setSearchTerm({ q })
const newPath = this.localePath({
path: '/search',
- query: { q: this.form.searchTerm },
+ query: { q },
})
this.$router.push(newPath)
},
@@ -160,27 +189,3 @@ export default {
},
}
</script>
-
-<!-- Add "scoped" attribute to limit CSS to this component only -->
-<style lang="scss" scoped>
-/* header */
-.logo {
- color: black;
- font-size: 2rem;
- font-weight: bold;
- &:link,
- &:visited,
- &:hover,
- &:active {
- text-decoration: none;
- }
-}
-
-.hero_search-form {
- margin: 0 15px;
-
- input {
- width: 16rem;
- }
-}
-</style>
diff --git a/src/layouts/default.vue b/src/layouts/default.vue
index 8fe2845b2..6d213583b 100644
--- a/src/layouts/default.vue
+++ b/src/layouts/default.vue
@@ -1,19 +1,28 @@
<template>
<div class="app">
- <HeaderSection :is-embedded="false" />
- <main>
+ <MigrationNotice v-show="isReferredFromCc" />
+ <HeaderSection />
+ <main class="embedded">
<Nuxt />
</main>
- <FooterSection />
</div>
</template>
<script>
-const defaultPage = {
- name: 'default',
- layout: 'default',
+import { mapState } from 'vuex'
+
+import iframeHeight from '~/mixins/iframe-height'
+import i18nSync from '~/mixins/i18n-sync'
+
+import { NAV } from '~/constants/store-modules'
+
+const embeddedPage = {
+ name: 'embedded',
+ layout: 'embedded',
+ mixins: [iframeHeight, i18nSync],
head() {
return this.$nuxtI18nHead({ addSeoAttributes: true, addDirAttribute: true })
},
+ computed: { ...mapState(NAV, ['isReferredFromCc']) },
}
-export default defaultPage
+export default embeddedPage
</script>
diff --git a/src/layouts/embedded-with-nav-search.vue b/src/layouts/embedded-with-nav-search.vue
deleted file mode 100644
index 2b581f792..000000000
--- a/src/layouts/embedded-with-nav-search.vue
+++ /dev/null
@@ -1,26 +0,0 @@
-<template>
- <div class="app">
- <MigrationNotice v-show="isReferredFromCc" />
- <HeaderSection :show-nav-search="true" />
- <main class="embedded">
- <Nuxt />
- </main>
- </div>
-</template>
-<script>
-import { mapState } from 'vuex'
-import iframeHeight from '~/mixins/iframe-height'
-import i18nSync from '~/mixins/i18n-sync'
-import { NAV } from '~/constants/store-modules'
-
-const embeddedWithNavSearch = {
- name: 'embedded-with-nav-search',
- layout: 'embedded-with-nav-search',
- mixins: [iframeHeight, i18nSync],
- head() {
- return this.$nuxtI18nHead({ addSeoAttributes: true, addDirAttribute: true })
- },
- computed: { ...mapState(NAV, ['isReferredFromCc']) },
-}
-export default embeddedWithNavSearch
-</script>
diff --git a/src/layouts/embedded.vue b/src/layouts/embedded.vue
deleted file mode 100644
index 1075e257c..000000000
--- a/src/layouts/embedded.vue
+++ /dev/null
@@ -1,26 +0,0 @@
-<template>
- <div class="app">
- <MigrationNotice v-show="isReferredFromCc" />
- <HeaderSection />
- <main class="embedded">
- <Nuxt />
- </main>
- </div>
-</template>
-<script>
-import { mapState } from 'vuex'
-import iframeHeight from '~/mixins/iframe-height'
-import i18nSync from '~/mixins/i18n-sync'
-import { NAV } from '~/constants/store-modules'
-
-const embeddedPage = {
- name: 'embedded',
- layout: 'embedded',
- mixins: [iframeHeight, i18nSync],
- head() {
- return this.$nuxtI18nHead({ addSeoAttributes: true, addDirAttribute: true })
- },
- computed: { ...mapState(NAV, ['isReferredFromCc']) },
-}
-export default embeddedPage
-</script>
diff --git a/src/layouts/with-nav-search.vue b/src/layouts/with-nav-search.vue
index 0a5bc1a36..78a4005eb 100644
--- a/src/layouts/with-nav-search.vue
+++ b/src/layouts/with-nav-search.vue
@@ -1,19 +1,28 @@
<template>
<div class="app">
- <HeaderSection :show-nav-search="true" :is-embedded="false" />
- <main>
+ <MigrationNotice v-show="isReferredFromCc" />
+ <HeaderSection :show-nav-search="true" />
+ <main class="embedded">
<Nuxt />
</main>
- <FooterSection />
</div>
</template>
<script>
-const withNavSearch = {
- name: 'with-nav-search',
- layout: 'with-nav-search',
+import { mapState } from 'vuex'
+
+import iframeHeight from '~/mixins/iframe-height'
+import i18nSync from '~/mixins/i18n-sync'
+
+import { NAV } from '~/constants/store-modules'
+
+const embeddedWithNavSearch = {
+ name: 'embedded-with-nav-search',
+ layout: 'embedded-with-nav-search',
+ mixins: [iframeHeight, i18nSync],
head() {
return this.$nuxtI18nHead({ addSeoAttributes: true, addDirAttribute: true })
},
+ computed: { ...mapState(NAV, ['isReferredFromCc']) },
}
-export default withNavSearch
+export default embeddedWithNavSearch
</script>
diff --git a/src/locales/po-files/openverse.pot b/src/locales/po-files/openverse.pot
index ac2186681..5437a25e3 100644
--- a/src/locales/po-files/openverse.pot
+++ b/src/locales/po-files/openverse.pot
@@ -1926,27 +1926,27 @@ msgctxt "footer.navigation.terms"
msgid "Terms"
msgstr ""
-#: src/components/EmbeddedNavSection.vue:59
+#: src/components/NavSection.vue:71
msgctxt "header.about-nav-item"
msgid "Our Story"
msgstr ""
-#: src/components/EmbeddedNavSection.vue:67
+#: src/components/NavSection.vue:79
msgctxt "header.source-nav-item"
msgid "Sources"
msgstr ""
-#: src/components/EmbeddedNavSection.vue:88
+#: src/components/NavSection.vue:100
msgctxt "header.search-guide-nav-item"
msgid "Search Guide"
msgstr ""
-#: src/components/EmbeddedNavSection.vue:96
+#: src/components/NavSection.vue:108
msgctxt "header.meta-search-nav-item"
msgid "Meta Search"
msgstr ""
-#: src/components/EmbeddedNavSection.vue:104
+#: src/components/NavSection.vue:116
msgctxt "header.feedback-nav-item"
msgid "Feedback"
msgstr ""
@@ -1955,32 +1955,32 @@ msgctxt "header.support-nav-item"
msgid "Support Us"
msgstr ""
-#: src/components/EmbeddedNavSection.vue:119
+#: src/components/NavSection.vue:131
msgctxt "header.extension-nav-item"
msgid "Web extension"
msgstr ""
-#: src/components/EmbeddedNavSection.vue:143
+#: src/components/NavSection.vue:169
msgctxt "header.placeholder"
msgid "Search all content"
msgstr ""
-#: src/components/EmbeddedNavSection.vue:76
+#: src/components/NavSection.vue:88
msgctxt "header.licenses-nav-item"
msgid "The Licenses"
msgstr ""
-#: src/components/EmbeddedNavSection.vue:52
+#: src/components/NavSection.vue:64
msgctxt "header.about-tab"
msgid "About"
msgstr ""
-#: src/components/EmbeddedNavSection.vue:81
+#: src/components/NavSection.vue:93
msgctxt "header.resources-tab"
msgid "Resources"
msgstr ""
-#: src/components/EmbeddedNavSection.vue:113
+#: src/components/NavSection.vue:125
msgctxt "header.api-nav-item"
msgid "API"
msgstr ""
@@ -1997,22 +1997,22 @@ msgctxt "header.notification.okay"
msgid "OK"
msgstr ""
-#: src/components/EmbeddedNavSection.vue:2
+#: src/components/NavSection.vue:6
msgctxt "header.aria.primary"
msgid "primary"
msgstr ""
-#: src/components/EmbeddedNavSection.vue:16
+#: src/components/NavSection.vue:26
msgctxt "header.aria.menu"
msgid "menu"
msgstr ""
-#: src/components/EmbeddedNavSection.vue:36
+#: src/components/NavSection.vue:46
msgctxt "header.aria.search"
msgid "search"
msgstr ""
-#: src/components/EmbeddedNavSection.vue:43
+#: src/components/NavSection.vue:53
msgctxt "header.aria.sr-search"
msgid "sr search button"
msgstr ""
diff --git a/src/pages/about.vue b/src/pages/about.vue
index a3bc8e42f..a1d950ad0 100644
--- a/src/pages/about.vue
+++ b/src/pages/about.vue
@@ -1,6 +1,6 @@
<template>
<div class="section" dir="ltr">
- <div :class="['container', isEmbedded ? '' : 'is-fluid']">
+ <div class="container">
<div>
<h1 class="text-5xl mb-10">
{{ $t('about.title') }}
@@ -96,19 +96,9 @@
</template>
<script>
-import { mapState } from 'vuex'
-import { NAV } from '~/constants/store-modules'
-
const AboutPage = {
name: 'about-page',
- layout({ store }) {
- return store.state.nav.isEmbedded
- ? 'embedded-with-nav-search'
- : 'with-nav-search'
- },
- computed: {
- ...mapState(NAV, ['isEmbedded']),
- },
+ layout: 'with-nav-search',
}
export default AboutPage
diff --git a/src/pages/audio/_id.vue b/src/pages/audio/_id.vue
index da2619719..67ea468d7 100644
--- a/src/pages/audio/_id.vue
+++ b/src/pages/audio/_id.vue
@@ -34,11 +34,7 @@ import { MEDIA } from '~/constants/store-modules'
const AudioDetailPage = {
name: 'AudioDetailPage',
mixins: [iframeHeight],
- layout({ store }) {
- return store.state.nav.isEmbedded
- ? 'embedded-with-nav-search'
- : 'with-nav-search'
- },
+ layout: 'with-nav-search',
data() {
return {
thumbnailURL: null,
diff --git a/src/pages/extension.vue b/src/pages/extension.vue
index e1a623767..e62b6d9be 100644
--- a/src/pages/extension.vue
+++ b/src/pages/extension.vue
@@ -1,7 +1,7 @@
<template>
<div dir="ltr">
<div class="hero-section border-b">
- <div class="container pt-16" :class="[isEmbedded ? '' : 'is-fluid']">
+ <div class="container pt-16">
<div class="intro text-center mx-auto">
<h2 class="text-5xl mb-10">
{{ $t('extension.description.intro') }}
@@ -27,7 +27,6 @@
</div>
<div
class="features grid grid-cols-1 tab:grid-cols-2 gap-x-12 gap-y-30 py-30 mx-auto"
- :class="[isEmbedded ? '' : 'is-fluid']"
>
<template v-for="(feature, index) in features">
<figure
@@ -58,10 +57,7 @@
</template>
</div>
<div class="section">
- <div
- class="container conclusion mb-24"
- :class="[isEmbedded ? '' : 'is-fluid']"
- >
+ <div class="container conclusion mb-24">
<h2 class="text-center mx-auto">{{ $t('extension.conclusion') }}</h2>
<ExtensionBrowsers class="mt-6" />
</div>
@@ -70,23 +66,16 @@
</template>
<script>
-import { mapState } from 'vuex'
-
import ExtensionBrowsers from '~/components/ExtensionBrowsers'
import feature1 from '~/assets/screenshots/extension_feat_1.png'
import feature2 from '~/assets/screenshots/extension_feat_2.png'
import feature3 from '~/assets/screenshots/extension_feat_3.png'
-import { NAV } from '~/constants/store-modules'
const AboutPage = {
name: 'about-page',
components: { ExtensionBrowsers },
- layout({ store }) {
- return store.state.nav.isEmbedded
- ? 'embedded-with-nav-search'
- : 'with-nav-search'
- },
+ layout: 'with-nav-search',
data() {
const features = [
{ key: 'search', image: feature1 },
@@ -98,9 +87,6 @@ const AboutPage = {
isPlaying: true,
}
},
- computed: {
- ...mapState(NAV, ['isEmbedded']),
- },
methods: {
togglePlay() {
if (this.isPlaying) {
diff --git a/src/pages/feedback.vue b/src/pages/feedback.vue
index b290b3aab..92eed38ff 100644
--- a/src/pages/feedback.vue
+++ b/src/pages/feedback.vue
@@ -1,6 +1,6 @@
<template>
<div class="section" dir="ltr">
- <div :class="['container', isEmbedded ? '' : 'is-fluid']">
+ <div class="container">
<div class="pb-6">
<h1 id="feedback" class="text-5xl mb-10">
{{ $t('feedback.title') }}
@@ -62,7 +62,7 @@
<script>
import { mapState } from 'vuex'
-import { BUG_REPORT, NAV } from '~/constants/store-modules'
+import { BUG_REPORT } from '~/constants/store-modules'
const bugForm =
'https://docs.google.com/forms/d/e/1FAIpQLSenCn-3HoZlCz4vlL2621wjezfu1sPZDaWGe_FtQ1R5-5qR4Q/viewform'
@@ -71,11 +71,7 @@ const suggestionForm =
export const FeedbackPage = {
name: 'feedback-page',
- layout({ store }) {
- return store.state.nav.isEmbedded
- ? 'embedded-with-nav-search'
- : 'with-nav-search'
- },
+ layout: 'with-nav-search',
data() {
return {
activeTab: 0,
@@ -103,7 +99,6 @@ export const FeedbackPage = {
'bugReported',
'bugReportFailed',
]),
- ...mapState(NAV, ['isEmbedded']),
},
}
diff --git a/src/pages/index.vue b/src/pages/index.vue
index bff1c7498..d3d9edd68 100644
--- a/src/pages/index.vue
+++ b/src/pages/index.vue
@@ -8,9 +8,7 @@ import { CLEAR_FILTERS } from '~/constants/action-types'
const HomePage = {
name: 'home-page',
- layout({ store }) {
- return store.state.nav.isEmbedded ? 'embedded' : 'default'
- },
+ layout: 'default',
beforeMount() {
this.$store.dispatch(`${SEARCH}/${CLEAR_FILTERS}`)
},
diff --git a/src/pages/meta-search.vue b/src/pages/meta-search.vue
index d31647063..61468fd52 100644
--- a/src/pages/meta-search.vue
+++ b/src/pages/meta-search.vue
@@ -1,6 +1,6 @@
<template>
<div class="section mb-10" dir="ltr">
- <div :class="['container', isEmbedded ? '' : 'is-fluid']">
+ <div class="container">
<div class="mb-10">
<h1 class="text-5xl">
{{ $t('meta-search-page.title') }}
@@ -116,19 +116,9 @@
</template>
<script>
-import { mapState } from 'vuex'
-import { NAV } from '~/constants/store-modules'
-
export default {
name: 'MetaSearchPage',
- layout({ store }) {
- return store.state.nav.isEmbedded
- ? 'embedded-with-nav-search'
- : 'with-nav-search'
- },
- computed: {
- ...mapState(NAV, ['isEmbedded']),
- },
+ layout: 'with-nav-search',
}
</script>
diff --git a/src/pages/photos/_id.vue b/src/pages/photos/_id.vue
index 3a7350121..b4c8d4f04 100644
--- a/src/pages/photos/_id.vue
+++ b/src/pages/photos/_id.vue
@@ -22,11 +22,7 @@ import { MEDIA } from '~/constants/store-modules'
const PhotoDetailPage = {
name: 'PhotoDetailPage',
- layout({ store }) {
- return store.state.nav.isEmbedded
- ? 'embedded-with-nav-search'
- : 'with-nav-search'
- },
+ layout: 'with-nav-search',
data() {
return {
breadCrumbURL: '',
diff --git a/src/pages/search-help.vue b/src/pages/search-help.vue
index e3bf488ae..91527e845 100644
--- a/src/pages/search-help.vue
+++ b/src/pages/search-help.vue
@@ -1,6 +1,6 @@
<template>
<div class="section" dir="ltr">
- <div :class="['container', isEmbedded ? '' : 'is-fluid']">
+ <div class="container">
<div class="mb-10">
<h1 class="text-5xl mb-10">
{{ $t('search-guide.title') }}
@@ -253,21 +253,9 @@
</template>
<script>
-/* eslint-disable vue/html-quotes */
-
-import { mapState } from 'vuex'
-import { NAV } from '~/constants/store-modules'
-
const SearchHelpPage = {
name: 'search-help-page',
- layout({ store }) {
- return store.state.nav.isEmbedded
- ? 'embedded-with-nav-search'
- : 'with-nav-search'
- },
- computed: {
- ...mapState(NAV, ['isEmbedded']),
- },
+ 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.vue
index 5c39af52a..fb6fe270f 100644
--- a/src/pages/search.vue
+++ b/src/pages/search.vue
@@ -41,6 +41,7 @@ const MIN_SCREEN_WIDTH_FILTER_VISIBLE_BY_DEFAULT = 768
const BrowsePage = {
name: 'browse-page',
+ layout: 'default',
components: {
SearchGridFilter,
},
@@ -54,9 +55,6 @@ const BrowsePage = {
isLargeScreen,
}
},
- layout({ store }) {
- return store.state.nav.isEmbedded ? 'embedded' : 'default'
- },
scrollToTop: false,
async fetch() {
if (this.mediaType !== VIDEO && this.results.items.length === 0) {
diff --git a/src/pages/sources.vue b/src/pages/sources.vue
index d0551a2a9..5957f508e 100644
--- a/src/pages/sources.vue
+++ b/src/pages/sources.vue
@@ -1,6 +1,6 @@
<template>
<div class="section" dir="ltr">
- <div :class="['container', isEmbedded ? '' : 'is-fluid']">
+ <div class="container">
<div class="mb-10">
<h1 class="text-5xl mb-10">
{{ $t('sources.title') }}
@@ -136,17 +136,13 @@
<script>
import sortBy from 'lodash.sortby'
import { mapState } from 'vuex'
-import { NAV, PROVIDER } from '~/constants/store-modules'
+import { PROVIDER } from '~/constants/store-modules'
const ARABIC_NUMERAL_LOCALES = ['ar', 'fa', 'ur', 'ckb', 'ps']
const SourcePage = {
name: 'source-page',
- layout({ store }) {
- return store.state.nav.isEmbedded
- ? 'embedded-with-nav-search'
- : 'with-nav-search'
- },
+ layout: 'with-nav-search',
data() {
return {
sort: {
@@ -156,7 +152,6 @@ const SourcePage = {
}
},
computed: {
- ...mapState(NAV, ['isEmbedded']),
...mapState(PROVIDER, ['imageProviders']),
sortedProviders() {
const sorted = sortBy(this.imageProviders, [this.sort.field])
diff --git a/test/unit/specs/components/nav-section.spec.js b/test/unit/specs/components/nav-section.spec.js
index 3c0232a1d..8dff9037f 100644
--- a/test/unit/specs/components/nav-section.spec.js
+++ b/test/unit/specs/components/nav-section.spec.js
@@ -38,7 +38,7 @@ describe('NavSection', () => {
const wrapper = render(NavSection, options)
await wrapper.setData({ form: { searchTerm: 'foo' } })
- wrapper.find('.hero_search-form').trigger('submit')
+ wrapper.find('.search-form').trigger('submit')
expect(routerMock.push).toHaveBeenCalledWith({
path: '/search',
query: { q: 'foo' },