@shopbite-de/storefront 2.0.1 → 2.0.2
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/CLAUDE.md +1 -1
- package/app/components/Home/Categories.vue +35 -4
- package/app/components/Home/Hero.vue +6 -3
- package/app/pages/index.vue +2 -1
- package/content.config.ts +5 -0
- package/package.json +1 -1
package/CLAUDE.md
CHANGED
|
@@ -137,7 +137,7 @@ Pages without content throw `createNotFoundError()` (`app/utils/notFound.ts`): f
|
|
|
137
137
|
- Product sheet (#442): `SbSheet` with a bon header (number strip, name as `DialogTitle`, diet and description as `DialogDescription`); `Configurator` shows variants as `SbChoiceGroup` (required), `DeselectIngredient` as `SbChip` ingredient chips (pressed = included), `CrossSelling` as `SbCheckbox` rows with a search, `Detail` a sticky footer with `SbStepper` and the add button.
|
|
138
138
|
- Cart and checkout (#443): `MenuOrderMode` (`useOrderMode`) shows the shipping methods as an `SbSegmentedControl` only when there are two to four. The header cart opens an `SbSheet`; `Cart/Item` uses `SbStepper` (remove at 1). The checkout is one page, `/bestellung/kasse` (the old step routes 301 there, `routeRules`): numbered sections Lieferung oder Abholung (`CheckoutPaymentAndDelivery part="shipping"`), Wann, Ihre Angaben (`CheckoutLoginOrRegister` with Reka tabs, `UserRegistrationForm` (logic in `useRegistrationForm`) / `UserLoginForm`, or `UserDetail`), Bezahlung (`part="payment"`) and the order card in `Checkout/Summary.vue`; the order button says "Zahlungspflichtig bestellen" (§ 312j BGB). Forms validate with Zod on submit and show errors at the fields plus a focused summary in form order; `AddressFields` sets `autocomplete`.
|
|
139
139
|
- Order and account (#445): `/bestellung/<id>/erfolg` and `/bestellung/<id>` render `OrderConfirmation` (`OrderDetail`: facts incl. the wished time from the `customerComment`, receipt lines, totals; call card), `/bestellung/<id>/fehler` a payment retry. Login, registration, password pages and the registration confirmation render in `UserAuthPanel`; the account pages in `layouts/account.vue` (link navigation with `aria-current`) with `UserAccountHeader`; `AddressForm` (also used when an address is edited in the checkout). Irreversible actions confirm with `SbConfirmDialog` (focus starts on "Abbrechen"). Search, contact (`useContactForm`), wishlist (`AddToWishlist`), content pages and `error.vue` (with its own `Header`/`Footer`, because the error page replaces `app.vue`) use the same pieces.
|
|
140
|
-
- Home page (#444): `pages/index.vue` renders `HomeHero` (kicker, `[highlight]{.text-primary}` part in the accent colour via `splitHighlight()`, buttons from `hero.links`, live status, rating card from the Google `usp`; the poster sits in a `<picture>` with a `min-width: 640px` source, so phones load a 1 px GIF), `HomeFacts` (`features`), `HomeCategories` (word list, `useHomeMenuCategories`), `HomeHighlights` (top sellers as bon cards), `HomeRestaurant` (`gallery` + opening hours in the SSR HTML) and the two-column `HomeFaq`; `cta` and `mittagstisch` in `content/index.yml` are not shown.
|
|
140
|
+
- Home page (#444): `pages/index.vue` renders `HomeHero` (kicker, `[highlight]{.text-primary}` part in the accent colour via `splitHighlight()`, buttons from `hero.links`, live status, rating card from the Google `usp`; the photo is `hero.image` with the blurred video `hero.poster` as fallback, cropped 4:5 at `hero.imagePosition` (object-position); it sits in a `<picture>` with a `min-width: 640px` source, so phones load a 1 px GIF), `HomeFacts` (`features`), `HomeCategories` (word list, `useHomeMenuCategories`; a wide first category image switches to a full-width photo below the words, and `sizes` asks for the width the crop needs, since thumbnails are picked by width), `HomeHighlights` (top sellers as bon cards), `HomeRestaurant` (`gallery` + opening hours in the SSR HTML) and the two-column `HomeFaq`; `cta` and `mittagstisch` in `content/index.yml` are not shown.
|
|
141
141
|
- Header and footer (#455): `Header.vue` (logo, main nav, status pill, phone, account, wishlist, cart button opening the cart `SbSheet`, menu `SbSheet` on phones), `Footer.vue` (address, hours, footer navigation columns). `app.vue` has the skip link to `main#inhalt`.
|
|
142
142
|
- Every colour pair a component renders must be in `CONTRAST_PAIRS`; `test/unit/themePresets.spec.ts` fails if a preset misses WCAG AA. Accent red is for headlines only, never on controls (reads as negative).
|
|
143
143
|
|
|
@@ -5,7 +5,9 @@ import type { Schemas } from "#shopware";
|
|
|
5
5
|
* Menu sections of the presets on the home page (#444): a word list in the
|
|
6
6
|
* display font on the darker band, no dish counts. On desktop one photo
|
|
7
7
|
* follows the hovered or focused section (category media from Shopware);
|
|
8
|
-
* phones get the words stacked and no photo.
|
|
8
|
+
* phones get the words stacked and no photo. Wide category banners (as in
|
|
9
|
+
* La Fattoria) do not fit the 4:5 column: then the photo spans the width
|
|
10
|
+
* below the words in the banner's own aspect ratio.
|
|
9
11
|
*/
|
|
10
12
|
withDefaults(
|
|
11
13
|
defineProps<{
|
|
@@ -27,6 +29,31 @@ const active = computed<Schemas["Category"] | undefined>(
|
|
|
27
29
|
sections.value.find((category) => category.media?.url),
|
|
28
30
|
);
|
|
29
31
|
|
|
32
|
+
function aspect(media: Schemas["Media"] | null | undefined) {
|
|
33
|
+
const size =
|
|
34
|
+
mediaSize(media) ??
|
|
35
|
+
[...(media?.thumbnails ?? [])].sort(
|
|
36
|
+
(a, b) => (b.width ?? 0) - (a.width ?? 0),
|
|
37
|
+
)[0];
|
|
38
|
+
return size?.width && size?.height ? size.width / size.height : null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// decided once by the first photo, so hovering does not change the layout
|
|
42
|
+
const bannerAspect = computed(() => {
|
|
43
|
+
const ratio = aspect(
|
|
44
|
+
sections.value.find((category) => category.media?.url)?.media,
|
|
45
|
+
);
|
|
46
|
+
return ratio && ratio > 1.2 ? ratio : null;
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// the browser picks the thumbnail by width, so a crop has to ask for the
|
|
50
|
+
// width the photo needs to fill the box in height
|
|
51
|
+
const sizes = computed(() => {
|
|
52
|
+
if (bannerAspect.value) return "min(76rem, calc(100vw - 4rem))";
|
|
53
|
+
const ratio = aspect(active.value?.media) ?? 0.8;
|
|
54
|
+
return `${Math.round(500 * Math.max(ratio, 0.8))}px`;
|
|
55
|
+
});
|
|
56
|
+
|
|
30
57
|
function name(category: Schemas["Category"]) {
|
|
31
58
|
return category.translated?.name ?? category.name;
|
|
32
59
|
}
|
|
@@ -42,7 +69,7 @@ function name(category: Schemas["Category"]) {
|
|
|
42
69
|
<div
|
|
43
70
|
:class="[
|
|
44
71
|
'mx-auto grid w-full max-w-(--sb-container) items-center gap-10 px-4 py-14 sm:px-6 lg:px-8 sm:py-24 lg:gap-[72px]',
|
|
45
|
-
active?.media?.url
|
|
72
|
+
active?.media?.url && !bannerAspect
|
|
46
73
|
? 'lg:grid-cols-[minmax(0,1.35fr)_minmax(0,0.65fr)]'
|
|
47
74
|
: '',
|
|
48
75
|
]"
|
|
@@ -101,11 +128,15 @@ function name(category: Schemas["Category"]) {
|
|
|
101
128
|
<img
|
|
102
129
|
:src="active.media.url"
|
|
103
130
|
:srcset="mediaSrcSet(active.media)"
|
|
104
|
-
sizes="
|
|
131
|
+
:sizes="sizes"
|
|
105
132
|
alt=""
|
|
106
133
|
loading="lazy"
|
|
107
134
|
decoding="async"
|
|
108
|
-
class="
|
|
135
|
+
:class="[
|
|
136
|
+
'w-full rounded-[20px] object-cover',
|
|
137
|
+
bannerAspect ? '' : 'aspect-[4/5]',
|
|
138
|
+
]"
|
|
139
|
+
:style="bannerAspect ? { aspectRatio: bannerAspect } : undefined"
|
|
109
140
|
/>
|
|
110
141
|
<figcaption class="font-body text-sm font-bold text-sb-ink">
|
|
111
142
|
{{ name(active) }}
|
|
@@ -17,7 +17,9 @@ const props = defineProps<{
|
|
|
17
17
|
title: string;
|
|
18
18
|
description?: string;
|
|
19
19
|
headline?: string;
|
|
20
|
-
|
|
20
|
+
image?: string;
|
|
21
|
+
// CSS object-position of the 4:5 crop, e.g. "50% 30%"
|
|
22
|
+
imagePosition?: string;
|
|
21
23
|
links?: HeroLink[];
|
|
22
24
|
usps?: HeroUsp[];
|
|
23
25
|
}>();
|
|
@@ -138,9 +140,9 @@ const BLANK =
|
|
|
138
140
|
</p>
|
|
139
141
|
</div>
|
|
140
142
|
|
|
141
|
-
<div v-if="
|
|
143
|
+
<div v-if="image" class="relative hidden sm:block">
|
|
142
144
|
<picture>
|
|
143
|
-
<source media="(min-width: 640px)" :srcset="
|
|
145
|
+
<source media="(min-width: 640px)" :srcset="image" />
|
|
144
146
|
<img
|
|
145
147
|
:src="BLANK"
|
|
146
148
|
alt=""
|
|
@@ -148,6 +150,7 @@ const BLANK =
|
|
|
148
150
|
height="1100"
|
|
149
151
|
fetchpriority="high"
|
|
150
152
|
class="block aspect-[4/5] w-full rounded-[999px_999px_20px_20px] object-cover"
|
|
153
|
+
:style="imagePosition ? { objectPosition: imagePosition } : undefined"
|
|
151
154
|
/>
|
|
152
155
|
</picture>
|
|
153
156
|
<component
|
package/app/pages/index.vue
CHANGED
|
@@ -40,7 +40,8 @@ useRestaurantSchema();
|
|
|
40
40
|
:title="page.hero.title || page.title"
|
|
41
41
|
:description="page.description"
|
|
42
42
|
:headline="page.hero.headline"
|
|
43
|
-
:
|
|
43
|
+
:image="page.hero.image || page.hero.poster"
|
|
44
|
+
:image-position="page.hero.imagePosition"
|
|
44
45
|
:links="page.hero.links"
|
|
45
46
|
:usps="page.hero.usps"
|
|
46
47
|
/>
|
package/content.config.ts
CHANGED
|
@@ -68,6 +68,11 @@ export default defineContentConfig({
|
|
|
68
68
|
hero: z.object({
|
|
69
69
|
backgroundVideo: z.string().optional(),
|
|
70
70
|
poster: z.string().optional(),
|
|
71
|
+
// Photo of the hero (#444), portrait 4:5 at about 1200×1500 px;
|
|
72
|
+
// `poster` (a frame of the video) is the fallback. imagePosition
|
|
73
|
+
// is the CSS object-position of the crop, e.g. "50% 30%".
|
|
74
|
+
image: z.string().optional(),
|
|
75
|
+
imagePosition: z.string().optional(),
|
|
71
76
|
headline: z.string().optional(),
|
|
72
77
|
// Hero title; the page title (shop name) is the fallback (#327).
|
|
73
78
|
title: z.string().optional(),
|