cloudcommerce 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/ecomplus-stores/monocard/functions/core/package.json +1 -1
- package/ecomplus-stores/monocard/functions/events/package.json +2 -2
- package/ecomplus-stores/monocard/functions/modules/package.json +2 -2
- package/ecomplus-stores/monocard/functions/passport/package.json +2 -2
- package/ecomplus-stores/monocard/functions/ssr/package.json +9 -6
- package/ecomplus-stores/monocard/package.json +1 -1
- package/ecomplus-stores/tia-sonia/functions/core/package.json +1 -1
- package/ecomplus-stores/tia-sonia/functions/events/package.json +2 -2
- package/ecomplus-stores/tia-sonia/functions/modules/package.json +2 -2
- package/ecomplus-stores/tia-sonia/functions/passport/package.json +2 -2
- package/ecomplus-stores/tia-sonia/functions/ssr/package.json +9 -6
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/{acai-com-granola.jpg → hero-acai-granola.jpg} +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/{cafe-com-tapioca-e-aveia.jpg → hero-cafe-tapioca-aveia.jpg} +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/hero-piquenique-snack-cookies.jpg +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/assets/prices.css +3 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/components/CategoriesSlider.vue +19 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/components/HeroBanner.vue +112 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/components/PitchBar.vue +48 -16
- package/ecomplus-stores/tia-sonia/functions/ssr/src/components/TheHeader.vue +39 -19
- package/ecomplus-stores/tia-sonia/functions/ssr/src/components/header/HeaderNav.vue +4 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/layouts/Base.astro +5 -3
- package/ecomplus-stores/tia-sonia/functions/ssr/src/main/Home.astro +55 -19
- package/ecomplus-stores/tia-sonia/functions/ssr/src/scripts/head-scripts.ts +15 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/scripts/modules-info-preset.ts +27 -0
- package/ecomplus-stores/tia-sonia/package.json +1 -1
- package/package.json +7 -7
- package/packages/api/package.json +1 -1
- package/packages/apps/correios/package.json +2 -2
- package/packages/apps/custom-payment/package.json +1 -1
- package/packages/apps/custom-shipping/package.json +1 -1
- package/packages/apps/discounts/package.json +1 -1
- package/packages/apps/emails/package.json +1 -1
- package/packages/apps/fb-conversions/package.json +1 -1
- package/packages/apps/frenet/package.json +3 -3
- package/packages/apps/galaxpay/package.json +2 -2
- package/packages/apps/infinitepay/package.json +2 -2
- package/packages/apps/jadlog/package.json +2 -2
- package/packages/apps/loyalty-points/package.json +1 -1
- package/packages/apps/mercadopago/package.json +2 -2
- package/packages/apps/pagarme/package.json +2 -2
- package/packages/apps/pix/package.json +2 -2
- package/packages/apps/tiny-erp/package.json +2 -2
- package/packages/cli/package.json +1 -1
- package/packages/config/package.json +1 -1
- package/packages/emails/package.json +2 -2
- package/packages/events/package.json +1 -1
- package/packages/firebase/package.json +1 -1
- package/packages/i18n/package.json +1 -1
- package/packages/modules/package.json +2 -2
- package/packages/passport/package.json +1 -1
- package/packages/ssr/package.json +2 -2
- package/packages/storefront/client.d.ts +1 -0
- package/packages/storefront/dist/client/HeaderButtons.6f668467.js +1 -0
- package/packages/storefront/dist/client/Prices.2ada125b.js +1 -0
- package/packages/storefront/dist/client/ProductCard.e5bdea60.js +1 -0
- package/packages/storefront/dist/client/assets/{_...slug_.15bda576.css → _...slug_.81b9a00c.css} +1 -1
- package/packages/storefront/dist/client/chunks/{HeaderButtons.1abd5bf4.js → HeaderButtons.cfa275db.js} +1 -1
- package/packages/storefront/dist/client/chunks/{LoginForm.7e7d6137.js → LoginForm.1ba3ad0d.js} +1 -1
- package/packages/storefront/dist/client/chunks/Prices.vue_vue_type_script_setup_true_lang.9a6ab0d6.js +1 -0
- package/packages/storefront/dist/client/chunks/{_plugin-vue_export-helper.fc452b02.js → _plugin-vue_export-helper.0d33cd48.js} +1 -1
- package/packages/storefront/dist/client/chunks/{runtime-core.esm-bundler.b4556b35.js → runtime-core.esm-bundler.45ba83fa.js} +1 -1
- package/packages/storefront/dist/client/{client.2a3e5a58.js → client.4d2b3a73.js} +1 -1
- package/packages/storefront/dist/client/sw.js +1 -1
- package/packages/storefront/dist/server/entry.mjs +226 -214
- package/packages/storefront/package.json +4 -4
- package/packages/storefront/src/lib/components/Prices.vue +113 -98
- package/packages/storefront/src/lib/composables/use-prices.ts +19 -12
- package/packages/storefront/src/lib/ssr/image.ts +3 -2
- package/packages/storefront/src/lib/state/modules-info.ts +10 -4
- package/packages/types/package.json +1 -1
- package/ecomplus-stores/tia-sonia/functions/ssr/src/scripts/InlineScripts.astro +0 -10
- package/packages/storefront/dist/client/HeaderButtons.300c19e5.js +0 -1
- package/packages/storefront/dist/client/Prices.6c44a513.js +0 -1
- package/packages/storefront/dist/client/ProductCard.69bba7fc.js +0 -1
- package/packages/storefront/dist/client/chunks/Prices.vue_vue_type_script_setup_true_lang.e4525076.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.1.7](https://github.com/ecomplus/cloud-commerce/compare/v0.1.6...v0.1.7) (2023-01-04)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **storefront:** New optional global `window.storefront.modulesInfoPreset` ([aa587fd](https://github.com/ecomplus/cloud-commerce/commit/aa587fd977016116b65b52847fd76121673dd464))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **deps:** update all non-major dependencies ([#101](https://github.com/ecomplus/cloud-commerce/issues/101)) ([9fcfe7c](https://github.com/ecomplus/cloud-commerce/commit/9fcfe7cfaed2a643cc19bad927d1bce42845655e))
|
|
16
|
+
* **storefront:** Edit `usePrices` composable to support compound discount labels ([7ae2114](https://github.com/ecomplus/cloud-commerce/commit/7ae211456949b8728857be79142d019a8653dabb))
|
|
17
|
+
* **storefront:** Fix `Prices` component slots binds to pass values instead of Computed/Ref objects ([951507a](https://github.com/ecomplus/cloud-commerce/commit/951507ace35fc69b96ba7387d5a557ee46a1ec06))
|
|
18
|
+
* **storefront:** Fix `window.storefront.modulesInfoPreset` typedef ([8bf3cc5](https://github.com/ecomplus/cloud-commerce/commit/8bf3cc53bf20c767d14915aa5f16bcd2d3bdc0e4))
|
|
19
|
+
* **storefront:** Fix typedef and cashback/installments handlers on `usePrices` and `Prices` ([f0bd969](https://github.com/ecomplus/cloud-commerce/commit/f0bd969cd6d646237d7c36df503d759ae1711fbf))
|
|
20
|
+
* **storefront:** Minor fix SSR image transform typedef to not require `alt` property ([0875cb0](https://github.com/ecomplus/cloud-commerce/commit/0875cb043bc002b765f02c04916aaa0633de605f))
|
|
21
|
+
* **storefront:** Remove root slot from `Prices` to support attributes inheritance ([9a0a8b0](https://github.com/ecomplus/cloud-commerce/commit/9a0a8b0246999d6cd48be2bad0896df95c944345))
|
|
22
|
+
|
|
5
23
|
### [0.1.6](https://github.com/ecomplus/cloud-commerce/compare/v0.1.5...v0.1.6) (2022-12-29)
|
|
6
24
|
|
|
7
25
|
|
|
@@ -12,18 +12,21 @@
|
|
|
12
12
|
"deploy": "firebase deploy --only functions",
|
|
13
13
|
"logs": "firebase functions:log"
|
|
14
14
|
},
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": "18"
|
|
17
|
+
},
|
|
15
18
|
"main": "index.js",
|
|
16
19
|
"dependencies": {
|
|
17
20
|
"@astrojs/image": "^0.12.1",
|
|
18
21
|
"@astrojs/node": "^4.0.0",
|
|
19
|
-
"@cloudcommerce/api": "^0.1.
|
|
20
|
-
"@cloudcommerce/firebase": "^0.1.
|
|
21
|
-
"@cloudcommerce/ssr": "^0.1.
|
|
22
|
+
"@cloudcommerce/api": "^0.1.6",
|
|
23
|
+
"@cloudcommerce/firebase": "^0.1.6",
|
|
24
|
+
"@cloudcommerce/ssr": "^0.1.6"
|
|
22
25
|
},
|
|
23
26
|
"devDependencies": {
|
|
24
|
-
"@cloudcommerce/i18n": "^0.1.
|
|
25
|
-
"@cloudcommerce/storefront": "^0.1.
|
|
26
|
-
"@cloudcommerce/types": "^0.1.
|
|
27
|
+
"@cloudcommerce/i18n": "^0.1.6",
|
|
28
|
+
"@cloudcommerce/storefront": "^0.1.6",
|
|
29
|
+
"@cloudcommerce/types": "^0.1.6",
|
|
27
30
|
"@iconify-json/arcticons": "^1.1.34",
|
|
28
31
|
"@iconify-json/wpf": "^1.1.3",
|
|
29
32
|
"lottie-web": "^5.10.0",
|
|
@@ -12,18 +12,21 @@
|
|
|
12
12
|
"deploy": "firebase deploy --only functions",
|
|
13
13
|
"logs": "firebase functions:log"
|
|
14
14
|
},
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": "18"
|
|
17
|
+
},
|
|
15
18
|
"main": "index.js",
|
|
16
19
|
"dependencies": {
|
|
17
20
|
"@astrojs/image": "^0.12.1",
|
|
18
21
|
"@astrojs/node": "^4.0.0",
|
|
19
|
-
"@cloudcommerce/api": "^0.1.
|
|
20
|
-
"@cloudcommerce/firebase": "^0.1.
|
|
21
|
-
"@cloudcommerce/ssr": "^0.1.
|
|
22
|
+
"@cloudcommerce/api": "^0.1.6",
|
|
23
|
+
"@cloudcommerce/firebase": "^0.1.6",
|
|
24
|
+
"@cloudcommerce/ssr": "^0.1.6"
|
|
22
25
|
},
|
|
23
26
|
"devDependencies": {
|
|
24
|
-
"@cloudcommerce/i18n": "^0.1.
|
|
25
|
-
"@cloudcommerce/storefront": "^0.1.
|
|
26
|
-
"@cloudcommerce/types": "^0.1.
|
|
27
|
+
"@cloudcommerce/i18n": "^0.1.6",
|
|
28
|
+
"@cloudcommerce/storefront": "^0.1.6",
|
|
29
|
+
"@cloudcommerce/types": "^0.1.6",
|
|
27
30
|
"@fontsource/dm-serif-text": "^4.5.9",
|
|
28
31
|
"@fontsource/roboto-condensed": "^4.5.9",
|
|
29
32
|
"@iconify-json/tabler": "^1.1.53"
|
|
File without changes
|
|
File without changes
|
package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/hero-piquenique-snack-cookies.jpg
ADDED
|
Binary file
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { Categories } from '@cloudcommerce/types';
|
|
3
|
+
|
|
4
|
+
export interface Props {
|
|
5
|
+
categories: Partial<Categories>[],
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
defineProps<Props>();
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<nav class="CategoriesSlider">
|
|
13
|
+
<ul role="list">
|
|
14
|
+
<li v-for="(category, i) in categories" :key="i">
|
|
15
|
+
{{ category.name }}
|
|
16
|
+
</li>
|
|
17
|
+
</ul>
|
|
18
|
+
</nav>
|
|
19
|
+
</template>
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { Products } from '@cloudcommerce/types';
|
|
3
|
+
import { ref } from 'vue';
|
|
4
|
+
import { useElementHover } from '@vueuse/core';
|
|
5
|
+
import { Popover, PopoverButton, PopoverPanel } from '@headlessui/vue';
|
|
6
|
+
import Prices from '@@components/Prices.vue';
|
|
7
|
+
|
|
8
|
+
export interface Props {
|
|
9
|
+
pointers?: Array<{
|
|
10
|
+
product: Partial<Products> & { price: number },
|
|
11
|
+
position: {
|
|
12
|
+
x: number,
|
|
13
|
+
y: number,
|
|
14
|
+
},
|
|
15
|
+
}>,
|
|
16
|
+
blogPost?: {
|
|
17
|
+
title: string,
|
|
18
|
+
link: string,
|
|
19
|
+
description: string,
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
defineProps<Props>();
|
|
24
|
+
const postLink = ref<HTMLElement>(null);
|
|
25
|
+
const isPostLinkHovered = useElementHover(postLink);
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<template>
|
|
29
|
+
<div class="relative">
|
|
30
|
+
<slot />
|
|
31
|
+
<Popover
|
|
32
|
+
v-for="{ product, position } in pointers"
|
|
33
|
+
:key="product.sku" class="z-20"
|
|
34
|
+
v-slot="{ open }"
|
|
35
|
+
>
|
|
36
|
+
<PopoverButton
|
|
37
|
+
class="absolute outline-none"
|
|
38
|
+
:style="{
|
|
39
|
+
top: `${position.y}%`,
|
|
40
|
+
left: `${position.x}%`,
|
|
41
|
+
}"
|
|
42
|
+
>
|
|
43
|
+
<span class="flex h-4 w-4">
|
|
44
|
+
<span
|
|
45
|
+
v-if="!open"
|
|
46
|
+
class="animate-ping absolute inline-flex h-full w-full
|
|
47
|
+
bg-primary opacity-75 rounded-full motion-reduce:hidden"
|
|
48
|
+
></span>
|
|
49
|
+
<span
|
|
50
|
+
class="relative inline-flex h-4 w-4 rounded-full"
|
|
51
|
+
:class="open ? 'bg-primary/90' : 'bg-primary/50'"
|
|
52
|
+
></span>
|
|
53
|
+
<Fade>
|
|
54
|
+
<PopoverPanel
|
|
55
|
+
class="absolute top-5 z-30"
|
|
56
|
+
:class="position.x > 55 ? 'right-0 text-right' : 'left-0 text-left'"
|
|
57
|
+
>
|
|
58
|
+
<article class="bg-white/80 rounded-sm w-60 py-2 px-3 leading-snug">
|
|
59
|
+
<div class="truncate text-sm mb-1">
|
|
60
|
+
<a
|
|
61
|
+
:href="product.slug"
|
|
62
|
+
:title="product.name"
|
|
63
|
+
class="underline decoration-dashed"
|
|
64
|
+
>
|
|
65
|
+
{{ product.name }}
|
|
66
|
+
</a>
|
|
67
|
+
</div>
|
|
68
|
+
<Prices :product="product"/>
|
|
69
|
+
<button class="bg-success-600 text-white hover:bg-success-700
|
|
70
|
+
rounded px-2 py-1 mt-1 mr-2 text-sm uppercase font-bold">
|
|
71
|
+
<i class="i-shopping-cart-plus"></i>
|
|
72
|
+
Comprar
|
|
73
|
+
</button>
|
|
74
|
+
<button class="bg-success-500 text-white hover:bg-success-700
|
|
75
|
+
rounded px-2 py-1 mt-1 text-sm uppercase font-bold">
|
|
76
|
+
<span class="text-xs">kit com</span> 3
|
|
77
|
+
<span class="bg-success-100 text-success-800
|
|
78
|
+
text-xs px-1 ml-1 rounded-full">
|
|
79
|
+
-5%
|
|
80
|
+
</span>
|
|
81
|
+
</button>
|
|
82
|
+
</article>
|
|
83
|
+
</PopoverPanel>
|
|
84
|
+
</Fade>
|
|
85
|
+
</span>
|
|
86
|
+
</PopoverButton>
|
|
87
|
+
</Popover>
|
|
88
|
+
<a
|
|
89
|
+
v-if="blogPost"
|
|
90
|
+
class="absolute bottom-0 left-0 w-full pb-3 px-7 z-10
|
|
91
|
+
hover:bg-white/70 transition-colors"
|
|
92
|
+
:href="blogPost.link"
|
|
93
|
+
ref="postLink"
|
|
94
|
+
>
|
|
95
|
+
<article class="prose">
|
|
96
|
+
<h3
|
|
97
|
+
class="font-brand mb-1 bg-secondary/90 rounded-sm text-white
|
|
98
|
+
inline-block px-3 py-2"
|
|
99
|
+
style="--un-prose-links: var(--c-primary)"
|
|
100
|
+
v-html="blogPost.title"
|
|
101
|
+
></h3>
|
|
102
|
+
<p
|
|
103
|
+
class="text-secondary text-lg"
|
|
104
|
+
:class="isPostLinkHovered
|
|
105
|
+
? 'my-3 xl:text-xl'
|
|
106
|
+
: 'my-1 underline decoration-2 truncate'"
|
|
107
|
+
v-html="blogPost.description"
|
|
108
|
+
></p>
|
|
109
|
+
</article>
|
|
110
|
+
</a>
|
|
111
|
+
</div>
|
|
112
|
+
</template>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { ref, computed } from 'vue';
|
|
2
|
+
import { ref, computed, watch } from 'vue';
|
|
3
|
+
import { useTimeout, useSwipe } from '@vueuse/core';
|
|
3
4
|
|
|
4
5
|
type Slide = {
|
|
5
6
|
icon?: 'shipping' | 'credit-card' | 'discount' | 'cashback',
|
|
@@ -28,27 +29,55 @@ const slideIndex = ref(0);
|
|
|
28
29
|
const slide = computed(() => {
|
|
29
30
|
return slides.value[slideIndex.value];
|
|
30
31
|
});
|
|
32
|
+
const { ready, start } = useTimeout(150, { controls: true, immediate: false });
|
|
33
|
+
const isToPrev = ref(false);
|
|
31
34
|
const prev = () => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
} else {
|
|
35
|
-
slideIndex.value = slides.value.length - 1;
|
|
36
|
-
}
|
|
35
|
+
isToPrev.value = true;
|
|
36
|
+
start();
|
|
37
37
|
};
|
|
38
38
|
const next = () => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
} else {
|
|
42
|
-
slideIndex.value = 0;
|
|
43
|
-
}
|
|
39
|
+
isToPrev.value = false;
|
|
40
|
+
start();
|
|
44
41
|
};
|
|
42
|
+
watch(ready, (isReady) => {
|
|
43
|
+
if (isReady) {
|
|
44
|
+
if (isToPrev.value) {
|
|
45
|
+
if (slideIndex.value) {
|
|
46
|
+
slideIndex.value -= 1;
|
|
47
|
+
} else {
|
|
48
|
+
slideIndex.value = slides.value.length - 1;
|
|
49
|
+
}
|
|
50
|
+
} else if (slideIndex.value < slides.value.length - 1) {
|
|
51
|
+
slideIndex.value += 1;
|
|
52
|
+
} else {
|
|
53
|
+
slideIndex.value = 0;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
const slider = ref<HTMLElement>(null);
|
|
58
|
+
useSwipe(slider, {
|
|
59
|
+
onSwipeEnd(e, direction) {
|
|
60
|
+
if (direction === 'LEFT') next();
|
|
61
|
+
else if (direction === 'RIGHT') prev();
|
|
62
|
+
},
|
|
63
|
+
});
|
|
45
64
|
</script>
|
|
46
65
|
|
|
47
66
|
<template>
|
|
48
|
-
<div class="PitchBar w-full
|
|
49
|
-
<div class="flex justify-between items-center max-w-4xl m-auto">
|
|
50
|
-
<button
|
|
51
|
-
|
|
67
|
+
<div class="PitchBar w-full px-2 py-1 bg-white/70 leading-snug">
|
|
68
|
+
<div class="flex justify-between items-center max-w-4xl m-auto" ref="slider">
|
|
69
|
+
<button
|
|
70
|
+
class="i-chevron-left text-2xl p-4 text-base-600 hover:text-base-800"
|
|
71
|
+
@click="prev"
|
|
72
|
+
></button>
|
|
73
|
+
<div
|
|
74
|
+
class="flex items-center gap-2 lg:gap-3 text-base-800
|
|
75
|
+
transition-transform duration-300"
|
|
76
|
+
:class="ready ? null : {
|
|
77
|
+
'motion-safe:translate-x-1/3': !isToPrev,
|
|
78
|
+
'motion-safe:-translate-x-1/3': isToPrev,
|
|
79
|
+
}"
|
|
80
|
+
>
|
|
52
81
|
<span v-if="slide.icon" class="text-2xl">
|
|
53
82
|
<i v-if="slide.icon === 'shipping'" class="i-truck-delivery"></i>
|
|
54
83
|
<i v-else-if="slide.icon === 'credit-card'" class="i-credit-card"></i>
|
|
@@ -59,7 +88,10 @@ const next = () => {
|
|
|
59
88
|
<strong v-if="slide.title" v-html="slide.title" class="uppercase"></strong>
|
|
60
89
|
<span v-html="slide.html"></span>
|
|
61
90
|
</div>
|
|
62
|
-
<button
|
|
91
|
+
<button
|
|
92
|
+
class="i-chevron-right text-2xl p-4 text-base-600 hover:text-base-800"
|
|
93
|
+
@click="next"
|
|
94
|
+
></button>
|
|
63
95
|
</div>
|
|
64
96
|
</div>
|
|
65
97
|
</template>
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
toRefs,
|
|
8
8
|
onMounted,
|
|
9
9
|
} from 'vue';
|
|
10
|
-
import { useWindowScroll } from '@vueuse/core';
|
|
10
|
+
import { promiseTimeout, useTimeout, useWindowScroll } from '@vueuse/core';
|
|
11
11
|
|
|
12
12
|
export interface Props {
|
|
13
13
|
logo?: ImgHTMLAttributes;
|
|
@@ -18,30 +18,51 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
18
18
|
logoAltHeading: 'h2',
|
|
19
19
|
});
|
|
20
20
|
const { logo } = toRefs(props);
|
|
21
|
-
const { y } = useWindowScroll();
|
|
22
21
|
const header = ref<HTMLElement | null>(null);
|
|
23
|
-
const logoImg = ref<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
const logoImg = ref<HTMLImageElement | null>(null);
|
|
23
|
+
const { ready, start } = useTimeout(100, { controls: true, immediate: false });
|
|
24
|
+
const height = ref(0);
|
|
25
|
+
if (!import.meta.env.SSR) {
|
|
26
|
+
onMounted(() => {
|
|
27
|
+
const fixHeight = () => {
|
|
28
|
+
height.value = header.value.offsetHeight;
|
|
29
|
+
start();
|
|
30
|
+
};
|
|
31
|
+
if (logoImg.value.complete && logoImg.value.naturalHeight !== 0) {
|
|
32
|
+
fixHeight();
|
|
33
|
+
} else {
|
|
34
|
+
logoImg.value.onload = fixHeight;
|
|
35
|
+
}
|
|
36
|
+
window.addEventListener('resize', fixHeight);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
const { y } = useWindowScroll();
|
|
40
|
+
const isSticky = computed(() => ready.value && y.value > height.value * 1.5);
|
|
41
|
+
const transition = ref('none');
|
|
42
|
+
watch(isSticky, async (isSetSticky) => {
|
|
43
|
+
if (!isSetSticky) {
|
|
44
|
+
start();
|
|
45
|
+
transition.value = 'none';
|
|
46
|
+
} else {
|
|
47
|
+
await promiseTimeout(300);
|
|
48
|
+
transition.value = 'opacity var(--transition-slow), transform var(--transition)';
|
|
49
|
+
}
|
|
29
50
|
});
|
|
30
|
-
const
|
|
31
|
-
const isSticky = computed(() => y.value > height);
|
|
51
|
+
const isScrollDown = ref(false);
|
|
32
52
|
watch(y, (newY, oldY) => {
|
|
33
|
-
|
|
53
|
+
isScrollDown.value = newY > 0 && newY < oldY;
|
|
34
54
|
});
|
|
35
55
|
</script>
|
|
36
56
|
|
|
37
57
|
<template>
|
|
58
|
+
<div :style="isSticky ? `height: ${height}px` : null"></div>
|
|
38
59
|
<header
|
|
39
|
-
class="TheHeader z-50
|
|
40
|
-
:class="
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
style="
|
|
60
|
+
class="TheHeader z-50 top-0 overflow-auto will-change-transform"
|
|
61
|
+
:class="{
|
|
62
|
+
'sticky bg-white/80 backdrop-blur-md shadow': isSticky,
|
|
63
|
+
'opacity-0 -translate-y-full': isSticky && !isScrollDown,
|
|
64
|
+
}"
|
|
65
|
+
:style="{ transition }"
|
|
45
66
|
ref="header"
|
|
46
67
|
>
|
|
47
68
|
<div
|
|
@@ -125,8 +146,7 @@ watch(y, (newY, oldY) => {
|
|
|
125
146
|
<ul class="flex items-center gap-2 md:gap-3 text-sm">
|
|
126
147
|
<li>
|
|
127
148
|
<a
|
|
128
|
-
class="
|
|
129
|
-
:class="isSticky ? 'bg-primary' : 'bg-primary/80'"
|
|
149
|
+
class="primary hover:bg-primary-300 font-bold uppercase rounded px-4 py-2"
|
|
130
150
|
href="#"
|
|
131
151
|
>
|
|
132
152
|
<i class="i-chevron-down mr-1"></i> Produtos
|
|
@@ -6,7 +6,7 @@ import '@fontsource/roboto-condensed';
|
|
|
6
6
|
import '@fontsource/roboto-condensed/400-italic.css';
|
|
7
7
|
import '@fontsource/roboto-condensed/700.css';
|
|
8
8
|
import '@fontsource/roboto-condensed/700-italic.css';
|
|
9
|
-
import
|
|
9
|
+
import '../assets/prices.css';
|
|
10
10
|
|
|
11
11
|
export interface Props {
|
|
12
12
|
pageContext: PageContext;
|
|
@@ -17,7 +17,9 @@ const { pageContext, title } = Astro.props as Props;
|
|
|
17
17
|
---
|
|
18
18
|
|
|
19
19
|
<Base pageContext={pageContext} title={title}>
|
|
20
|
-
<
|
|
20
|
+
<Fragment slot="before-head-end">
|
|
21
|
+
<script src="../scripts/head-scripts.ts"></script>
|
|
22
|
+
</Fragment>
|
|
21
23
|
<slot />
|
|
22
24
|
</Base>
|
|
23
25
|
|
|
@@ -37,7 +39,7 @@ body {
|
|
|
37
39
|
overflow-x: hidden;
|
|
38
40
|
background-color: var(--c-brand-light-blue);
|
|
39
41
|
}
|
|
40
|
-
a {
|
|
42
|
+
a, button {
|
|
41
43
|
transition: color var(--transition), background-color var(--transition);
|
|
42
44
|
}
|
|
43
45
|
</style>
|
|
@@ -3,35 +3,71 @@ import type { PageContext } from '@@sf/ssr-context';
|
|
|
3
3
|
import api from '@cloudcommerce/api';
|
|
4
4
|
import { Image } from '@astrojs/image/components';
|
|
5
5
|
import PitchBar from '@@components/PitchBar.vue';
|
|
6
|
+
import HeroBanner from '@@components/HeroBanner.vue';
|
|
6
7
|
|
|
7
8
|
export interface Props {
|
|
8
9
|
pageContext: PageContext;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
const products = (await api.get('products'))
|
|
12
|
+
const products = (await api.get('products?fields=name,slug,sku,price,base_price'))
|
|
13
|
+
.data.result;
|
|
14
|
+
const heroBanners = [{
|
|
15
|
+
src: '/img/uploads/hero-acai-granola.jpg',
|
|
16
|
+
alt: 'Açaí com morango, banana, manga e granola Tia Sônia',
|
|
17
|
+
pointers: [{
|
|
18
|
+
product: products.find(({ sku }) => sku === 'PA285'),
|
|
19
|
+
position: { x: 20, y: 35 },
|
|
20
|
+
}],
|
|
21
|
+
blogPost: {
|
|
22
|
+
title: 'Granola: 10 Benefícios para sua Saúde',
|
|
23
|
+
link: '/posts/10-beneficios-da-granola-para-a-sua-saude-2020-05-22',
|
|
24
|
+
description: `A granola é uma opção na alimentação saudável que acompanha a dieta
|
|
25
|
+
de pessoas ao redor de todo o mundo, saiba mais sobre o assunto em nosso blog!`,
|
|
26
|
+
}
|
|
27
|
+
}, {
|
|
28
|
+
src: '/img/uploads/hero-piquenique-snack-cookies.jpg',
|
|
29
|
+
alt: 'Piquenique com frutas, pães com pasta de amendoim, snacks e cookies Tia Sônia',
|
|
30
|
+
pointers: [{
|
|
31
|
+
product: products.find(({ sku }) => sku === 'PA588'),
|
|
32
|
+
position: { x: 21, y: 50 },
|
|
33
|
+
}, {
|
|
34
|
+
product: products.find(({ sku }) => sku === 'PA358'),
|
|
35
|
+
position: { x: 24, y: 80 },
|
|
36
|
+
}, {
|
|
37
|
+
product: products.find(({ sku }) => sku === 'PA352'),
|
|
38
|
+
position: { x: 84, y: 20 },
|
|
39
|
+
}, {
|
|
40
|
+
product: products.find(({ sku }) => sku === 'PA291'),
|
|
41
|
+
position: { x: 74, y: 46 },
|
|
42
|
+
}],
|
|
43
|
+
}];
|
|
44
|
+
const { pageContext: { apiState } } = Astro.props as Props;
|
|
12
45
|
---
|
|
13
46
|
|
|
14
47
|
<section class="relative">
|
|
15
|
-
<PitchBar class="absolute top-0 left-0" client:
|
|
16
|
-
<div class="grid grid-cols-2">
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
quality={75}
|
|
30
|
-
width={1080}
|
|
31
|
-
height={1080}
|
|
32
|
-
/>
|
|
48
|
+
<PitchBar class="absolute top-0 left-0 z-10" client:load />
|
|
49
|
+
<div class="bg-white grid grid-cols-2">
|
|
50
|
+
{heroBanners.map(({ src, alt, pointers, blogPost }) => (
|
|
51
|
+
<HeroBanner client:visible {pointers} {blogPost}>
|
|
52
|
+
<Image
|
|
53
|
+
src={src}
|
|
54
|
+
alt={alt}
|
|
55
|
+
format={'webp'}
|
|
56
|
+
quality={75}
|
|
57
|
+
width={1080}
|
|
58
|
+
height={1080}
|
|
59
|
+
/>
|
|
60
|
+
</HeroBanner>
|
|
61
|
+
))}
|
|
33
62
|
</div>
|
|
34
63
|
</section>
|
|
64
|
+
<section class="bg-base-100 py-9">
|
|
65
|
+
<ul role="list" class="mt-3 fs-20">
|
|
66
|
+
{apiState.categories?.map((category) => <li>
|
|
67
|
+
<a href={`/${category.slug}`}>{category.name} ({category.icon?.url})</a>
|
|
68
|
+
</li>)}
|
|
69
|
+
</ul>
|
|
70
|
+
</section>
|
|
35
71
|
<article class="bg-white p-6">
|
|
36
72
|
<h1 class="font-brand">
|
|
37
73
|
Welcome to
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import modulesInfoPreset from './modules-info-preset';
|
|
2
|
+
|
|
3
|
+
if (window.storefront) {
|
|
4
|
+
window.storefront.modulesInfoPreset = modulesInfoPreset;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/* eslint-disable quotes, comma-dangle */
|
|
8
|
+
window.firebaseConfig = {
|
|
9
|
+
apiKey: "AIzaSyDZ5QPJaLZM1bxEJyGbyK1weoBZ1TiLgFc",
|
|
10
|
+
authDomain: "ecom2-tiasonia.firebaseapp.com",
|
|
11
|
+
projectId: "ecom2-tiasonia",
|
|
12
|
+
storageBucket: "ecom2-tiasonia.appspot.com",
|
|
13
|
+
messagingSenderId: "895718193792",
|
|
14
|
+
appId: "1:895718193792:web:1d4fd74466248202994465"
|
|
15
|
+
};
|