Skip to content

Commit c1c32f4

Browse files
authored
chore: some updates on storefront (#267)
* chore: some updates on storefront * chore: update
1 parent 3fadfe4 commit c1c32f4

File tree

8 files changed

+2365
-2140
lines changed

8 files changed

+2365
-2140
lines changed

apps/web-storefront/app/components/Header.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@
2828
/>
2929
</template>
3030
</UModal>
31+
32+
<UColorModeButton
33+
color="neutral"
34+
variant="outline"
35+
size="lg"
36+
/>
3137
</div>
3238

3339
<div class="flex items-center shrink-0 gap-3">

apps/web-storefront/app/components/Navigation.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
/>
3737
</div>
3838

39-
<div class="shrink-0 flex items-center gap-1.5 py-2 px-2">
40-
<ColorModeToggle />
41-
</div>
39+
<!-- <div class="shrink-0 flex items-center gap-1.5 py-2 px-2">
40+
<UColorModeButton />
41+
</div> -->
4242
</template>
4343

4444
<script setup lang="ts">
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
<template>
2+
<div class="mt-8 w-full">
3+
<UCarousel
4+
ref="carousel"
5+
v-slot="{ item }"
6+
:items="preparedPins"
7+
loop
8+
arrows
9+
:auto-scroll="{
10+
active: true,
11+
playOnInit: true,
12+
startDelay: 200,
13+
speed: 0.5,
14+
stopOnInteraction: true,
15+
stopOnMouseEnter: true,
16+
}"
17+
:ui="{
18+
item: 'basis-60 py-1',
19+
prev: 'absolute left-4! size-10 justify-center rounded-full',
20+
next: 'absolute right-4! size-10 justify-center rounded-full',
21+
}"
22+
>
23+
<NuxtLink
24+
:to="undefined"
25+
class="h-full self-start"
26+
>
27+
<UPageCard
28+
variant="subtle"
29+
:ui="{
30+
root: 'w-56 aspect-2/3 self-start hover:scale-98 active:scale-95 duration-200 cursor-pointer',
31+
container: 'p-0!',
32+
}"
33+
>
34+
<template #body>
35+
<div v-if="item.type === 'review_quote_with_image'" class="h-full p-2.5 flex flex-col gap-2 justify-between overflow-hidden">
36+
<div class="flex flex-col gap-2">
37+
<div class="flex flex-row gap-2 items-center line-clamp-1">
38+
<UAvatar
39+
v-if="item.user?.avatarUrl"
40+
:src="item.user.avatarUrl"
41+
size="md"
42+
/>
43+
<h4 class="font-semibold leading-6">
44+
{{ item.user?.name }}
45+
</h4>
46+
</div>
47+
48+
<p class="text-sm/4 text-muted italic before:content-[open-quote] after:content-[close-quote] line-clamp-3">
49+
{{ item.text }}
50+
</p>
51+
</div>
52+
53+
<div class="shrink-0 w-full h-auto aspect-square flex flex-col justify-center items-center rounded-lg">
54+
<img
55+
v-if="item.mediaUrl"
56+
:src="item.mediaUrl"
57+
loading="lazy"
58+
class="w-full h-full object-cover rounded-lg"
59+
>
60+
</div>
61+
</div>
62+
63+
<div v-if="item.type === 'image'" class="w-full h-full">
64+
<img
65+
v-if="item.mediaUrl"
66+
:src="item.mediaUrl"
67+
loading="lazy"
68+
class="w-full h-full object-cover rounded-lg"
69+
>
70+
</div>
71+
</template>
72+
</UPageCard>
73+
</NuxtLink>
74+
</UCarousel>
75+
</div>
76+
</template>
77+
78+
<script setup lang="ts">
79+
import type { ShallowRef, ShallowUnwrapRef } from 'vue'
80+
import { useMouseInElement } from '@vueuse/core'
81+
82+
const { pins } = defineProps<{ pins: any[] }>()
83+
84+
const carousel = useTemplateRef('carousel')
85+
const { isOutside } = useMouseInElement(carousel as unknown as ShallowRef<ShallowUnwrapRef<HTMLElement>>)
86+
87+
onMounted(() => {
88+
const interval = setInterval(() => {
89+
if (carousel.value && isOutside.value) {
90+
carousel.value?.emblaApi?.plugins().autoScroll.play()
91+
}
92+
}, 2000)
93+
onBeforeUnmount(() => clearInterval(interval))
94+
})
95+
96+
const minimum = 9
97+
98+
const preparedPins = computed(() => {
99+
const filtered = pins.filter((pin) => pin.type !== 'empty')
100+
const emptyCount = Math.max(0, minimum - filtered.length)
101+
const emptyPins: any[] = Array.from({ length: emptyCount }, (_, i) => ({
102+
id: `empty-${i}`,
103+
createdAt: new Date().toISOString(),
104+
updatedAt: new Date().toISOString(),
105+
type: 'image',
106+
userId: null,
107+
user: null,
108+
text: null,
109+
mediaUrl: '/slider-test.jpg',
110+
pageId: 'placeholder',
111+
}))
112+
return [...filtered, ...emptyPins]
113+
})
114+
</script>

apps/web-storefront/app/pages/index.vue

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
11
<template>
2-
<div class="mb-12 flex flex-row gap-6 md:items-center">
3-
<div class="flex flex-col items-center justify-center shrink-0 size-28 bg-linear-to-br from-secondary-400 to-secondary-500 rounded-lg">
2+
<div class="mb-12 flex flex-col md:flex-row gap-6 md:items-center">
3+
<div class="w-full md:w-76 py-4 px-6 aspect-3/1 flex flex-col items-center justify-center shrink-0 bg-secondary-500 rounded-lg">
44
<img
5-
src="/sushi-heart-light.png"
5+
src="/logo-full.png"
66
alt=""
7-
class="w-20 h-auto"
7+
class="w-full h-auto"
88
>
99
</div>
1010

1111
<div class="flex flex-col gap-2">
1212
<h1 class="text-2xl md:text-3xl font-semibold tracking-tight">
1313
{{ channelStore?.name }}
1414
</h1>
15-
<div class="max-w-xl text-base/5 md:text-lg/5">
15+
<div class="max-w-xl text-base/5">
1616
{{ channelStore?.description }}
1717
</div>
1818
</div>
1919
</div>
2020

21+
<div class="mb-12">
22+
<PinsBlock :pins="[]" />
23+
</div>
24+
2125
<CategoryBlock
2226
v-for="(category, index) in menuStore.menu?.categories"
2327
:key="category.id"
30.5 KB
Loading
90.1 KB
Loading

0 commit comments

Comments
 (0)