Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions components/Carousel.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<script setup>
const props = defineProps(['siteConfig'])
const siteConfig = props.siteConfig
</script>

<template>
<div v-if="siteConfig.carousel && siteConfig.carousel.items" id="default-carousel" class="relative w-full"
:data-carousel="siteConfig.carousel.status">
<!-- Carousel wrapper -->
<div class="relative h-56 overflow-hidden rounded-lg md:h-80">
<template v-for="item in siteConfig.carousel.items">
<div class="hidden duration-700 ease-in-out" data-carousel-item>
<a :href="item.url" target="_blank" class="h-56 md:h-80 cursor-pointer">
<figure>
<NuxtImg loading="lazy" format="webp" :src="item.cover" :alt="item.title"
class="absolute block w-full h-full -translate-x-1/2 -translate-y-1/2 top-1/2 left-1/2 object-cover brightness-75" />
</figure>
<div
class="absolute top-4 md:top-6 lg:top-8 left-4 md:left-8 lg:left-16 py-5 text-left text-white space-y-4">
<div class="text-xl sm:text-2xl md:text-3xl lg:text-4xl font-medium"
:class="[item.titleClass ? item.titleClass : '']">
{{ item.title }}
</div>
<div class="w-2/3" :class="[item.titleClass ? item.descClass : '']">
{{ item.desc }}
</div>
</div>
</a>
</div>
</template>
</div>
<!-- Slider indicators -->
<div v-if="siteConfig.carousel.items.length > 1"
class="absolute z-30 flex -translate-x-1/2 bottom-5 left-1/2 space-x-3 rtl:space-x-reverse">
<template v-for="(item, index) in siteConfig.carousel.items">
<button type="button" class="w-3 h-3 rounded-full" :aria-current="index === 0" :aria-label="item.title"
:data-carousel-slide-to="index"></button>
</template>
</div>
</div>
</template>
6 changes: 6 additions & 0 deletions components/Home/Theme1.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ const filterSkus = (projects, keyword = '') => {
const props = defineProps(['merchant'])
const merchant = useDataMerchantInfo()
merchant.value = props.merchant
const siteSettings = merchant.value.website ? merchant.value.website.settings : {}

filterSkus(merchant.value.projects)

watch(merchant, () => {
Expand Down Expand Up @@ -112,6 +114,10 @@ onMounted(() => {
</div>
</div>

<ClientOnly>
<Carousel :siteConfig="siteSettings" />
</ClientOnly>

<div v-if="!isNotEmptyObj(selectedSKU)" id="skus" class="space-y-4">
<div class="space-y-2">
<button v-for="cate in cates" @click="changeCate(cate.code)" class="mr-2 btn btn-xs btn-outline rounded-md"
Expand Down
7 changes: 6 additions & 1 deletion components/Home/Theme2.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ const selectedSKU = useState('SelectedSKU', () => { return {} })
const props = defineProps(['merchant'])
const merchant = useDataMerchantInfo()
merchant.value = props.merchant

const siteSettings = merchant.value.website ? merchant.value.website.settings : {}
const projects = merchant.value.projects

projects.forEach((project) => {
if (!['DIGITAL', 'GROUP'].includes(project.type)) {
return
Expand Down Expand Up @@ -73,6 +74,10 @@ onMounted(() => {
</div>
</div>

<ClientOnly>
<Carousel :siteConfig="siteSettings" />
</ClientOnly>

<div v-if="!isNotEmptyObj(selectedSKU)" id="projects" class="space-y-4">
<div class="space-y-2">
<button v-for="cate in cates" @click="changeCate(cate.code)" class="mr-2 btn btn-xs btn-outline rounded-md"
Expand Down