Skip to content

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

Add redesigned homepage (#593)

Zack Krida2fbd78eff232
diff --git a/nuxt.config.js b/nuxt.config.js
index 5c2133c37..b621a54cd 100644
--- a/nuxt.config.js
+++ b/nuxt.config.js
@@ -42,6 +42,11 @@ const meta = [
name: 'monetization',
content: '$ilp.uphold.com/edR8erBDbRyq',
},
+ {
+ hid: 'theme-color',
+ name: 'theme-color',
+ content: '#ffffff',
+ },
]
if (process.env.NODE_ENV === 'production') {
diff --git a/src/assets/homepage_images/Olympics-1.jpg b/src/assets/homepage_images/Olympics-1.jpg
new file mode 100644
index 000000000..bad791080
Binary files /dev/null and b/src/assets/homepage_images/Olympics-1.jpg differ
diff --git a/src/assets/homepage_images/Olympics-2.jpg b/src/assets/homepage_images/Olympics-2.jpg
new file mode 100644
index 000000000..d777fa8c7
Binary files /dev/null and b/src/assets/homepage_images/Olympics-2.jpg differ
diff --git a/src/assets/homepage_images/Olympics-3.jpg b/src/assets/homepage_images/Olympics-3.jpg
new file mode 100644
index 000000000..ffed80317
Binary files /dev/null and b/src/assets/homepage_images/Olympics-3.jpg differ
diff --git a/src/assets/homepage_images/Olympics-4.jpg b/src/assets/homepage_images/Olympics-4.jpg
new file mode 100644
index 000000000..e5f627af3
Binary files /dev/null and b/src/assets/homepage_images/Olympics-4.jpg differ
diff --git a/src/assets/homepage_images/Olympics-5.jpg b/src/assets/homepage_images/Olympics-5.jpg
new file mode 100644
index 000000000..3cea55a61
Binary files /dev/null and b/src/assets/homepage_images/Olympics-5.jpg differ
diff --git a/src/assets/homepage_images/Olympics-6.jpg b/src/assets/homepage_images/Olympics-6.jpg
new file mode 100644
index 000000000..7b1aaca24
Binary files /dev/null and b/src/assets/homepage_images/Olympics-6.jpg differ
diff --git a/src/assets/homepage_images/Olympics-7.jpg b/src/assets/homepage_images/Olympics-7.jpg
new file mode 100644
index 000000000..b23bd06ab
Binary files /dev/null and b/src/assets/homepage_images/Olympics-7.jpg differ
diff --git a/src/assets/homepage_images/Pottery-1.jpg b/src/assets/homepage_images/Pottery-1.jpg
new file mode 100644
index 000000000..8f8a7e5dd
Binary files /dev/null and b/src/assets/homepage_images/Pottery-1.jpg differ
diff --git a/src/assets/homepage_images/Pottery-2.jpg b/src/assets/homepage_images/Pottery-2.jpg
new file mode 100644
index 000000000..7ca776497
Binary files /dev/null and b/src/assets/homepage_images/Pottery-2.jpg differ
diff --git a/src/assets/homepage_images/Pottery-3.jpg b/src/assets/homepage_images/Pottery-3.jpg
new file mode 100644
index 000000000..2f7cb192b
Binary files /dev/null and b/src/assets/homepage_images/Pottery-3.jpg differ
diff --git a/src/assets/homepage_images/Pottery-4.jpg b/src/assets/homepage_images/Pottery-4.jpg
new file mode 100644
index 000000000..ca3e56b3b
Binary files /dev/null and b/src/assets/homepage_images/Pottery-4.jpg differ
diff --git a/src/assets/homepage_images/Pottery-5.jpg b/src/assets/homepage_images/Pottery-5.jpg
new file mode 100644
index 000000000..8342f5de0
Binary files /dev/null and b/src/assets/homepage_images/Pottery-5.jpg differ
diff --git a/src/assets/homepage_images/Pottery-6.jpg b/src/assets/homepage_images/Pottery-6.jpg
new file mode 100644
index 000000000..4d684a817
Binary files /dev/null and b/src/assets/homepage_images/Pottery-6.jpg differ
diff --git a/src/assets/homepage_images/Pottery-7.jpg b/src/assets/homepage_images/Pottery-7.jpg
new file mode 100644
index 000000000..fcd7bbbce
Binary files /dev/null and b/src/assets/homepage_images/Pottery-7.jpg differ
diff --git a/src/assets/homepage_images/Universe-1.jpg b/src/assets/homepage_images/Universe-1.jpg
new file mode 100644
index 000000000..7d6b5ed1f
Binary files /dev/null and b/src/assets/homepage_images/Universe-1.jpg differ
diff --git a/src/assets/homepage_images/Universe-2.jpg b/src/assets/homepage_images/Universe-2.jpg
new file mode 100644
index 000000000..cf0abfc1a
Binary files /dev/null and b/src/assets/homepage_images/Universe-2.jpg differ
diff --git a/src/assets/homepage_images/Universe-3.jpg b/src/assets/homepage_images/Universe-3.jpg
new file mode 100644
index 000000000..c0bc4ab75
Binary files /dev/null and b/src/assets/homepage_images/Universe-3.jpg differ
diff --git a/src/assets/homepage_images/Universe-4.jpg b/src/assets/homepage_images/Universe-4.jpg
new file mode 100644
index 000000000..763db13bd
Binary files /dev/null and b/src/assets/homepage_images/Universe-4.jpg differ
diff --git a/src/assets/homepage_images/Universe-5.jpg b/src/assets/homepage_images/Universe-5.jpg
new file mode 100644
index 000000000..5301e888c
Binary files /dev/null and b/src/assets/homepage_images/Universe-5.jpg differ
diff --git a/src/assets/homepage_images/Universe-6.jpg b/src/assets/homepage_images/Universe-6.jpg
new file mode 100644
index 000000000..08efb93f3
Binary files /dev/null and b/src/assets/homepage_images/Universe-6.jpg differ
diff --git a/src/assets/homepage_images/Universe-7.jpg b/src/assets/homepage_images/Universe-7.jpg
new file mode 100644
index 000000000..40ead4fea
Binary files /dev/null and b/src/assets/homepage_images/Universe-7.jpg differ
diff --git a/src/assets/homepage_images/image_info.json b/src/assets/homepage_images/image_info.json
new file mode 100644
index 000000000..09ac3fbb0
--- /dev/null
+++ b/src/assets/homepage_images/image_info.json
@@ -0,0 +1,127 @@
+{
+ "sets": [
+ {
+ "term": "Universe",
+ "prefix": "Universe",
+ "images": [
+ {
+ "index": 1,
+ "title": "Mandela base",
+ "identifier": "cfa45160-a7be-4911-9b9f-4e66678ec7f7"
+ },
+ {
+ "index": 2,
+ "title": "Saturn's Rings in Ultraviolet Light",
+ "identifier": "47e4e857-07ef-4a97-b6ca-94126a3c4246"
+ },
+ {
+ "index": 3,
+ "title": "Starburst Cluster Shows Celestial Fireworks",
+ "identifier": "09e5cb23-db65-48a0-bb3a-2a6f7e028d84"
+ },
+ {
+ "index": 4,
+ "title": "Neutron Stars Rip Each Other Apart to Form Black Hole",
+ "identifier": "8da073a3-21bd-4722-87f1-2cf5104bb33f"
+ },
+ {
+ "index": 5,
+ "title": "Hubbell Revival-style Rug with Moki (Moqui) Stripes",
+ "identifier": "19d3e29b-c7a1-427a-925c-7ecb041fefcf"
+ },
+ {
+ "index": 6,
+ "title": "Planisphaerium Ptolemaicum siue machina orbium mundi ex hypothesi Ptolemaica in plano disposita",
+ "identifier": "bee966d9-8095-4349-abb9-576dedc1be1a"
+ },
+ {
+ "index": 7,
+ "title": "Carina Nebula Detail",
+ "identifier": "190ecf9b-acfa-4aef-8805-3445e7b91db1"
+ }
+ ]
+ },
+ {
+ "term": "Indigenous pottery",
+ "prefix": "Pottery",
+ "images": [
+ {
+ "index": 1,
+ "title": "Impasto four-handled ovoid olla with lid, from S. Marzano sul Sarno",
+ "identifier": "802d76cd-84cf-45bc-81ac-610331dab420"
+ },
+ {
+ "index": 2,
+ "title": "Female Figurine Rattle",
+ "identifier": "80f0cae9-0574-48be-9458-c514dcb105be"
+ },
+ {
+ "index": 3,
+ "title": "Architectural Sculpture Fragment",
+ "identifier": "0a67002e-92ad-4d6a-9384-c9fd2eb41477"
+ },
+ {
+ "index": 4,
+ "title": "Tribal Art New York 2011: Africa/Oceana/Americas",
+ "identifier": "8ebf0e1c-4375-47e8-9365-ed20850f9b47"
+ },
+ {
+ "index": 5,
+ "title": "Tiwi Islands indigenous pottery, Museum & Art Gallery of the NT, Darwin, Australia.01",
+ "identifier": "9466e58e-614f-4e39-a36b-e0ba8924443c"
+ },
+ {
+ "index": 6,
+ "title": "Lima_2018 05 13_1096",
+ "identifier": "39e1c7e8-01d8-472c-8fd2-6c070da277de"
+ },
+ {
+ "index": 7,
+ "title": "Female Holding A Bowl Figurine",
+ "identifier": "03226074-7d2e-4a23-921a-3f76bf349ea2"
+ }
+ ]
+ },
+ {
+ "term": "Olympic games",
+ "prefix": "Olympics",
+ "images": [
+ {
+ "index": 1,
+ "title": "Olympic Games Seoul ´88",
+ "identifier": "53841492-9703-4892-96b4-10297dd84ed0"
+ },
+ {
+ "index": 2,
+ "title": "Bob Beamon",
+ "identifier": "1663eec8-7b2c-4a84-8d25-0543482c23ef"
+ },
+ {
+ "index": 3,
+ "title": "Olympic Games. Stockholm 1912",
+ "identifier": "32814c7e-2c3d-451b-b33e-12bf4c0d5413"
+ },
+ {
+ "index": 4,
+ "title": "Youth Olympic Games",
+ "identifier": "e7ebeaaf-1cb2-4bae-a6e8-550aaa2e1e1d"
+ },
+ {
+ "index": 5,
+ "title": "File:The victorious English 400 m. women's relay swimming team at Wellcome V0048555.jpg",
+ "identifier": "648b566f-0228-4819-83d5-8f1d324ec06d"
+ },
+ {
+ "index": 6,
+ "title": "Youth Olympic Games",
+ "identifier": "2c8ce5eb-5031-4d38-9a65-967a919a6055"
+ },
+ {
+ "index": 7,
+ "title": "File:Wrestling at the 2016 Summer Olympics – Men's freestyle 86 kg 5 (0).jpg",
+ "identifier": "31616f0d-3f70-4ea1-8132-d73f7c2145bf"
+ }
+ ]
+ }
+ ]
+}
diff --git a/src/constants/media.js b/src/constants/media.js
index cf6eec1e1..852d89dee 100644
--- a/src/constants/media.js
+++ b/src/constants/media.js
@@ -10,7 +10,7 @@ export const ALL_MEDIA = 'all'
* These types also support custom filters.
* @type {MediaType[]}
*/
-export const supportedMediaTypes = [AUDIO, IMAGE]
+export const supportedMediaTypes = [IMAGE, AUDIO]
/**
* The types of content that users can search. `All` is also an option here.
diff --git a/src/layouts/error.vue b/src/layouts/error.vue
index 29f09001e..64c9d812f 100644
--- a/src/layouts/error.vue
+++ b/src/layouts/error.vue
@@ -2,7 +2,10 @@
<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" />
+ <OpenverseLogo
+ aria-hidden="true"
+ class="pt-6 lg:pt-8 ms-6 lg:ms-10 w-30 h-auto"
+ />
</NuxtLink>
<Oops
aria-hidden="true"
@@ -49,13 +52,13 @@ 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 OpenverseLogo from '~/assets/logo.svg?inline'
import VSearchBar from '~/components/VHeader/VSearchBar/VSearchBar'
const Error = defineComponent({
name: 'ErrorPage',
components: {
- Logo,
+ OpenverseLogo,
Oops,
VSearchBar,
},
@@ -94,6 +97,15 @@ const Error = defineComponent({
handleSearch,
}
},
+ head: {
+ meta: [
+ {
+ hid: 'theme-color',
+ name: 'theme-color',
+ content: '#ffe033',
+ },
+ ],
+ },
})
export default Error
</script>
diff --git a/src/locales/en.json b/src/locales/en.json
index 60e7a1c44..2503f7fea 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -8,14 +8,14 @@
"hero": {
"brand": "Openverse",
"title": "Search for content to reuse",
- "subtitle": "Browse over 500 million images, available for reuse",
+ "subtitle": "Browse through over 600 million items to reuse",
"search": {
"placeholder": "Search all content",
"button": "Search"
},
- "caption": {
- "content": "All our content is under Creative Commons licenses or in the public domain. {link} about CC licenses and tools.",
- "link": "Learn more"
+ "disclaimer": {
+ "content": "All Openverse content is under a {license} or is in the public domain.",
+ "license": "Creative Commons license"
},
"license-filter": {
"label": "I want something I can"
diff --git a/src/locales/po-files/openverse.pot b/src/locales/po-files/openverse.pot
index cc4782143..34cdde035 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-18T06:42:25+00:00\n"
+"POT-Creation-Date: 2022-01-20T16:25:56+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -34,16 +34,22 @@ msgctxt "search-type.video"
msgid "Videos"
msgstr ""
+#: src/components/VContentSwitcher/VContentSwitcherPopover.vue:5
msgctxt "search-type.label"
msgid "Type of content to search"
msgstr ""
+#: src/components/VContentSwitcher/VMobileMenuModal.vue:24
+msgctxt "search-type.heading"
+msgid "Content types"
+msgstr ""
+
#: src/components/VModal/VMobileModalContent.vue:30
msgctxt "modal.close"
msgid "Close"
msgstr ""
-#: src/components/DownloadButton.vue:14
+#: src/components/DownloadButton.vue:15
msgctxt "download-button.download"
msgid "Download"
msgstr ""
@@ -69,7 +75,7 @@ msgctxt "migration-notice.read"
msgid "Read more"
msgstr ""
-#: src/components/DropdownButton.vue:71
+#: src/components/DropdownButton.vue:82
msgctxt "dropdown-button.aria.arrow-label"
msgid "Dropdown"
msgstr ""
@@ -2049,18 +2055,18 @@ msgctxt "header.api-nav-item"
msgid "API"
msgstr ""
-#: src/components/VHeader/VHeader.vue:194
+#: src/components/VHeader/VHeader.vue:206
msgctxt "header.loading"
msgid "Loading..."
msgstr ""
-#: src/components/VHeader/VFilterButton.vue:82
+#: src/components/VContentSwitcher/VMobileMenuModal.vue:17
msgctxt "header.filter-button.simple"
msgid "Filters"
msgstr ""
#. Do not translate words between ### ###.
-#: src/components/VHeader/VFilterButton.vue:77
+#: src/components/VHeader/VFilterButton.vue:78
msgctxt "header.filter-button.with-count"
msgid "###count### Filter | ###count### Filters"
msgstr ""
@@ -2116,6 +2122,7 @@ msgctxt "notification.translation.link"
msgid "contributing a translation"
msgstr ""
+#: src/pages/index.vue:11
msgctxt "hero.brand"
msgid "Openverse"
msgstr ""
@@ -2127,7 +2134,7 @@ msgstr ""
#: src/components/VHeroSection.vue:9
msgctxt "hero.subtitle"
-msgid "Browse over 500 million images, available for reuse"
+msgid "Browse through over 600 million items to reuse"
msgstr ""
#: src/components/SearchTypeToggle.vue:19
@@ -2175,14 +2182,14 @@ msgid "I want something I can"
msgstr ""
#. Do not translate words between ### ###.
-#: src/components/VHeroSection.vue:45
-msgctxt "hero.caption.content"
-msgid "All our content is under Creative Commons licenses or in the public domain. ###link### about CC licenses and tools."
+#: src/pages/index.vue:39
+msgctxt "hero.disclaimer.content"
+msgid "All Openverse content is under a ###license### or is in the public domain."
msgstr ""
-#: src/components/VHeroSection.vue:53
-msgctxt "hero.caption.link"
-msgid "Learn more"
+#: src/pages/index.vue:48
+msgctxt "hero.disclaimer.license"
+msgid "Creative Commons license"
msgstr ""
#: src/components/VHeroSection.vue:28
@@ -2195,13 +2202,13 @@ msgctxt "hero.search.button"
msgid "Search"
msgstr ""
-#: src/layouts/error.vue:15
+#: src/layouts/error.vue:18
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
+#: src/layouts/error.vue:21
msgctxt "404.main"
msgid "Go to ###link### or search for something similar from the field below."
msgstr ""
@@ -2211,7 +2218,7 @@ msgctxt "404.link-title"
msgid "Openverse"
msgstr ""
-#: src/layouts/error.vue:31
+#: src/layouts/error.vue:34
msgctxt "404.search-placeholder"
msgid "Search for content to reuse"
msgstr ""
diff --git a/src/pages/index.vue b/src/pages/index.vue
index 9c6bbdff2..986db2b3b 100644
--- a/src/pages/index.vue
+++ b/src/pages/index.vue
@@ -1,23 +1,286 @@
<template>
- <VHeroSection />
+ <main
+ class="flex flex-col lg:flex-row justify-center gap-6 lg:gap-0 bg-yellow h-screen overflow-hidden"
+ >
+ <!-- TODO: Refine min-width for different breakpoints, remove magic numbers -->
+ <header
+ class="flex-grow w-full lg:w-auto lg:min-w-[32rem] xl:min-w-[64rem] box-border px-6 lg:pl-30 lg:pr-0 xl:px-40 mx-auto flex flex-col justify-center"
+ >
+ <NuxtLink to="/" class="relative z-10">
+ <h1>
+ <span class="sr-only">{{ $t('hero.brand') }}</span>
+ <!-- width and height chosen w.r.t. viewBox "0 0 280 42" -->
+ <OpenverseLogo
+ aria-hidden="true"
+ class="lg:-translate-x-24 w-30 lg:h-[63px] lg:w-auto pt-6 lg:pt-0"
+ />
+ </h1>
+ </NuxtLink>
+
+ <h2 class="text-4xl lg:text-6xl mt-auto lg:mt-6">
+ {{ $t('hero.subtitle') }}
+ </h2>
+ <VSearchBar
+ v-model.trim="searchTerm"
+ class="max-w-[40rem] mt-4 lg:mt-8"
+ :placeholder="featuredSearchText"
+ @submit="handleSearch"
+ >
+ <VContentSwitcherPopover
+ v-if="isMounted && isMinScreenMd"
+ ref="contentSwitcher"
+ class="mx-3"
+ :active-item="contentType"
+ @select="setContentType"
+ />
+ </VSearchBar>
+
+ <!-- Disclaimer for large screens -->
+ <i18n
+ path="hero.disclaimer.content"
+ tag="p"
+ class="hidden lg:block text-sr mt-4"
+ >
+ <template #license>
+ <a
+ href="https://creativecommons.org/licenses/"
+ class="text-dark-charcoal hover:text-dark-charcoal underline"
+ >{{ $t('hero.disclaimer.license') }}</a
+ >
+ </template>
+ </i18n>
+ </header>
+
+ <!-- Image carousel -->
+ <div class="flex-grow overflow-hidden w-full lg:w-auto lg:h-full px-6">
+ <!-- Height is 114.286vh i.e. 100vh * 8/7 (so that 0.75, 1, 1, 0.75 circles are visible) -->
+ <!-- Width is 57.143vh i.e. half of height (because grid dimensions are 4 ⨯ 2) -->
+ <div
+ class="homepage-images flex flex-row gap-4 lg:gap-0 items-center lg:grid lg:grid-cols-2 lg:grid-rows-4 lg:w-[57.143vh] lg:h-[114.286vh]"
+ >
+ <Transition
+ v-for="(image, index) in featuredSearchImages"
+ :key="image.identifier"
+ name="fade"
+ mode="out-in"
+ appear
+ >
+ <NuxtLink
+ :key="image.identifier"
+ :to="image.url"
+ class="homepage-image block aspect-square h-30 w-30 lg:h-auto lg:w-auto lg:m-[2vh] rounded-full"
+ :style="{ '--transition-index': `${index * 0.05}s` }"
+ >
+ <img
+ class="object-cover h-full w-full rounded-full"
+ :src="image.src"
+ :alt="image.title"
+ :title="image.title"
+ />
+ </NuxtLink>
+ </Transition>
+ </div>
+ </div>
+
+ <!-- Disclaimer as footer for small screens -->
+ <i18n
+ path="hero.disclaimer.content"
+ tag="p"
+ class="lg:hidden text-sr p-6 mt-auto"
+ >
+ <template #license>
+ <a
+ href="https://creativecommons.org/licenses/"
+ class="text-dark-charcoal hover:text-dark-charcoal underline"
+ >{{ $t('hero.disclaimer.license') }}</a
+ >
+ </template>
+ </i18n>
+ </main>
</template>
<script>
-import { SEARCH } from '~/constants/store-modules'
-import { CLEAR_FILTERS } from '~/constants/action-types'
+import {
+ ref,
+ onMounted,
+ onBeforeUnmount,
+ useRouter,
+ useStore,
+ useContext,
+} from '@nuxtjs/composition-api'
+
+import VContentSwitcherPopover from '~/components/VContentSwitcher/VContentSwitcherPopover.vue'
-import VHeroSection from '~/components/VHeroSection.vue'
+import { isMinScreen } from '~/composables/use-media-query'
+
+import { ALL_MEDIA } from '~/constants/media'
+import { MEDIA, SEARCH } from '~/constants/store-modules'
+import { FETCH_MEDIA, UPDATE_QUERY } from '~/constants/action-types'
+
+import imageInfo from '~/assets/homepage_images/image_info.json'
+
+import OpenverseLogo from '~/assets/logo.svg?inline'
const HomePage = {
name: 'home-page',
- layout: 'default',
+ layout: 'blank',
components: {
- VHeroSection,
+ OpenverseLogo,
+ VContentSwitcherPopover,
},
- beforeMount() {
- this.$store.dispatch(`${SEARCH}/${CLEAR_FILTERS}`)
+ head: {
+ meta: [
+ {
+ hid: 'theme-color',
+ name: 'theme-color',
+ content: '#ffe033',
+ },
+ ],
+ },
+ setup() {
+ const { app } = useContext()
+ const router = useRouter()
+ const store = useStore()
+
+ const featuredSearches = imageInfo.sets.map((setItem) => ({
+ ...setItem,
+ images: setItem.images.map((imageItem) => ({
+ ...imageItem,
+ src: require(`~/assets/homepage_images/${setItem.prefix}-${imageItem.index}.jpg`),
+ url: router.resolve({
+ name: 'image-id',
+ params: { id: imageItem.identifier },
+ }).href,
+ })),
+ }))
+
+ const featuredSearchIdx = ref(-1) // immediately updates to 0 on mount
+ const nextIdx = () => {
+ featuredSearchIdx.value =
+ (featuredSearchIdx.value + 1) % featuredSearches.length
+ const featuredSearch = featuredSearches[featuredSearchIdx.value]
+ typeText(featuredSearch.term, () => {
+ setImages(featuredSearch.images)
+ })
+ }
+
+ const rotationTime = 6e3 // ms
+ let rotInterval = null
+ onMounted(() => {
+ nextIdx()
+ rotInterval = setInterval(nextIdx, rotationTime)
+ document.addEventListener('visibilitychange', () => {
+ if (document.visibilityState === 'visible') {
+ rotInterval = setInterval(nextIdx, rotationTime)
+ } else if (document.visibilityState === 'hidden' && rotInterval) {
+ clearInterval(rotInterval)
+ }
+ })
+ })
+ onBeforeUnmount(() => {
+ if (rotInterval) {
+ clearInterval(rotInterval)
+ }
+ })
+
+ const featuredSearchText = ref('')
+ const keystrokeTime = 100 // ms
+ const typeText = (text, callback) => {
+ let length = 0
+ const typeInterval = setInterval(() => {
+ length += 1
+ featuredSearchText.value = text.substring(0, length)
+ if (length === text.length) {
+ clearInterval(typeInterval)
+ callback()
+ }
+ }, keystrokeTime)
+ }
+
+ const featuredSearchImages = ref([])
+ const setImages = (images) => {
+ featuredSearchImages.value = images
+ }
+
+ const isMounted = ref(false)
+ onMounted(() => {
+ isMounted.value = true
+ })
+ onBeforeUnmount(() => {
+ isMounted.value = false
+ })
+
+ const isMinScreenMd = isMinScreen('md', { shouldPassInSSR: true })
+
+ const contentSwitcher = ref(null)
+ const contentType = ref(ALL_MEDIA)
+ const setContentType = async (type) => {
+ contentType.value = type
+ contentSwitcher.value?.closeMenu()
+ await store.dispatch(`${SEARCH}/${UPDATE_QUERY}`, {
+ searchType: type,
+ })
+ }
+
+ const searchTerm = ref('')
+ const handleSearch = async () => {
+ await store.dispatch(`${SEARCH}/${UPDATE_QUERY}`, {
+ q: searchTerm.value || featuredSearches[featuredSearchIdx.value].term,
+ })
+ const newPath = app.localePath({
+ path: `/search/${contentType.value === 'all' ? '' : contentType.value}`,
+ query: store.getters['search/searchQueryParams'],
+ })
+ router.push(newPath)
+
+ await store.dispatch(`${MEDIA}/${FETCH_MEDIA}`, {
+ ...store.getters['search/searchQueryParams'],
+ })
+ }
+
+ return {
+ featuredSearchText,
+ featuredSearchImages,
+
+ isMounted,
+
+ isMinScreenMd,
+
+ contentSwitcher,
+ contentType,
+ setContentType,
+
+ searchTerm,
+ handleSearch,
+ }
},
}
export default HomePage
</script>
+
+<style>
+@screen lg {
+ .homepage-images {
+ transform: translateY(-7.143vh);
+ }
+
+ .homepage-image:nth-child(even) {
+ transform: translateY(50%);
+ }
+}
+
+.homepage-image {
+ transition-delay: var(--transition-index) !important;
+}
+
+.fade-enter,
+.fade-leave-to {
+ opacity: 0;
+}
+
+.fade-enter-active,
+.fade-leave-active {
+ transition: 0.5s;
+}
+</style>
diff --git a/tailwind.config.js b/tailwind.config.js
index 32ee6b670..c8efbf791 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -88,6 +88,7 @@ module.exports = {
20: '5.00rem',
24: '6.00rem',
30: '7.50rem',
+ 40: '10.00rem',
64: '16.00rem',
70: '17.50rem',
80: '20.00rem',