@eldrajs/theme-cli 0.2.8 → 0.2.10
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 +3 -1
- package/package.json +1 -1
- package/template/.eldra/block-types.d.ts +28 -7
- package/template/.eldra/manifest.json +1034 -355
- package/template/.eldra/previews.json +35 -35
- package/template/README.md +32 -0
- package/template/app/assets/main.css +23 -0
- package/template/app/plugins/eldra-storefront.ts +3 -0
- package/template/app/storefront/demo.ts +75 -24
- package/template/app/storefront/gateway.ts +16 -2
- package/template/blocks/announcement-bar/preview.png +0 -0
- package/template/blocks/article/preview.json +4 -4
- package/template/blocks/article/preview.png +0 -0
- package/template/blocks/article-list/Block.vue +48 -19
- package/template/blocks/article-list/__tests__/Block.spec.ts +15 -0
- package/template/blocks/article-list/preview.json +43 -43
- package/template/blocks/article-list/preview.png +0 -0
- package/template/blocks/breadcrumbs/preview.png +0 -0
- package/template/blocks/cart/preview.png +0 -0
- package/template/blocks/collection-grid/Block.vue +260 -9
- package/template/blocks/collection-grid/__tests__/Block.spec.ts +202 -0
- package/template/blocks/collection-grid/block.json +3 -3
- package/template/blocks/collection-grid/preview.png +0 -0
- package/template/blocks/collection-header/Block.vue +82 -58
- package/template/blocks/collection-header/__tests__/Block.spec.ts +77 -1
- package/template/blocks/collection-header/preview.json +4 -4
- package/template/blocks/collection-header/preview.png +0 -0
- package/template/blocks/contact/preview.png +0 -0
- package/template/blocks/cta/preview.json +4 -4
- package/template/blocks/cta/preview.png +0 -0
- package/template/blocks/faq/preview.png +0 -0
- package/template/blocks/feature-grid/Block.vue +73 -4
- package/template/blocks/feature-grid/__tests__/Block.spec.ts +43 -1
- package/template/blocks/feature-grid/block.json +2 -2
- package/template/blocks/feature-grid/preview.json +49 -24
- package/template/blocks/feature-grid/preview.png +0 -0
- package/template/blocks/footer/Block.vue +186 -71
- package/template/blocks/footer/__tests__/Block.spec.ts +127 -32
- package/template/blocks/footer/block.json +42 -4
- package/template/blocks/footer/mock.json +31 -34
- package/template/blocks/footer/preview.png +0 -0
- package/template/blocks/form/preview.png +0 -0
- package/template/blocks/gallery/preview.json +24 -24
- package/template/blocks/gallery/preview.png +0 -0
- package/template/blocks/hero/Block.vue +117 -19
- package/template/blocks/hero/__tests__/Block.spec.ts +46 -0
- package/template/blocks/hero/block.json +36 -1
- package/template/blocks/hero/preview.json +33 -25
- package/template/blocks/hero/preview.png +0 -0
- package/template/blocks/image/preview.json +4 -4
- package/template/blocks/image/preview.png +0 -0
- package/template/blocks/logo-cloud/preview.png +0 -0
- package/template/blocks/navigation/Block.vue +623 -184
- package/template/blocks/navigation/__tests__/Block.spec.ts +416 -68
- package/template/blocks/navigation/__tests__/fixtures/menu.json +182 -0
- package/template/blocks/navigation/block.json +102 -6
- package/template/blocks/navigation/mock.json +279 -52
- package/template/blocks/navigation/preview.json +311 -0
- package/template/blocks/navigation/preview.png +0 -0
- package/template/blocks/newsletter/Block.vue +248 -144
- package/template/blocks/newsletter/__tests__/Block.spec.ts +42 -0
- package/template/blocks/newsletter/block.json +61 -2
- package/template/blocks/newsletter/preview.json +35 -0
- package/template/blocks/newsletter/preview.png +0 -0
- package/template/blocks/order-status/preview.png +0 -0
- package/template/blocks/pricing-table/preview.png +0 -0
- package/template/blocks/product-carousel/Block.vue +272 -26
- package/template/blocks/product-carousel/__tests__/Block.spec.ts +90 -0
- package/template/blocks/product-carousel/block.json +61 -0
- package/template/blocks/product-carousel/preview.json +12 -0
- package/template/blocks/product-carousel/preview.png +0 -0
- package/template/blocks/product-detail/Block.vue +148 -96
- package/template/blocks/product-detail/__tests__/Block.spec.ts +98 -74
- package/template/blocks/product-detail/block.json +11 -4
- package/template/blocks/product-detail/mock.json +53 -22
- package/template/blocks/product-detail/parts/Gallery.vue +52 -103
- package/template/blocks/product-detail/preview.png +0 -0
- package/template/blocks/quote/preview.png +0 -0
- package/template/blocks/rich-text/preview.png +0 -0
- package/template/blocks/search/Block.vue +1 -0
- package/template/blocks/search/TypeSection.vue +1 -0
- package/template/blocks/search/__tests__/Block.spec.ts +23 -0
- package/template/blocks/search/preview.png +0 -0
- package/template/blocks/split-content/Block.vue +98 -20
- package/template/blocks/split-content/__tests__/Block.spec.ts +57 -18
- package/template/blocks/split-content/block.json +72 -6
- package/template/blocks/split-content/preview.json +34 -13
- package/template/blocks/split-content/preview.png +0 -0
- package/template/blocks/stats/preview.png +0 -0
- package/template/blocks/tabs/preview.json +16 -16
- package/template/blocks/tabs/preview.png +0 -0
- package/template/blocks/team/preview.png +0 -0
- package/template/blocks/testimonials/preview.png +0 -0
- package/template/blocks/timeline/preview.png +0 -0
- package/template/blocks/trust-strip/Block.vue +67 -1
- package/template/blocks/trust-strip/__tests__/Block.spec.ts +30 -1
- package/template/blocks/trust-strip/block.json +4 -4
- package/template/blocks/trust-strip/preview.json +21 -0
- package/template/blocks/trust-strip/preview.png +0 -0
- package/template/blocks/video-embed/preview.png +0 -0
- package/template/blocks/wishlist/preview.png +0 -0
- package/template/i18n/en-US.json +16 -9
- package/template/i18n/is-IS.json +16 -9
- package/template/pages/article.page.json +19 -18
- package/template/pages/cart.page.json +3 -13
- package/template/pages/category.page.json +15 -7
- package/template/pages/collection.page.json +15 -14
- package/template/pages/home.page.json +217 -182
- package/template/pages/product.page.json +46 -36
- package/template/pages/products.page.json +3 -13
- package/template/pages/search.page.json +3 -13
- package/template/pages/wishlist.page.json +3 -13
- package/template/public/images/CREDITS.md +28 -0
- package/template/public/images/clay-hands.webp +0 -0
- package/template/public/images/coffee-table.webp +0 -0
- package/template/public/images/cup.webp +0 -0
- package/template/public/images/enamel-cups.webp +0 -0
- package/template/public/images/hero.webp +0 -0
- package/template/public/images/kitchen.webp +0 -0
- package/template/public/images/mug.webp +0 -0
- package/template/public/images/northwind-mark.svg +1 -0
- package/template/public/images/planters.webp +0 -0
- package/template/public/images/plates.webp +0 -0
- package/template/public/images/reading.webp +0 -0
- package/template/public/images/sweater.webp +0 -0
- package/template/public/images/terracotta.webp +0 -0
- package/template/public/images/throws.webp +0 -0
- package/template/public/images/vase.webp +0 -0
- package/template/public/images/wheel.webp +0 -0
- package/template/public/images/yarn-tools.webp +0 -0
- package/template/public/images/yarn.webp +0 -0
- package/template/stories/generated/collection-grid.stories.ts +6 -0
- package/template/stories/generated/feature-grid.stories.ts +6 -0
- package/template/stories/generated/footer.stories.ts +4 -4
- package/template/stories/generated/hero.stories.ts +6 -0
- package/template/stories/generated/navigation.stories.ts +14 -1
- package/template/stories/generated/newsletter.stories.ts +2 -1
- package/template/stories/generated/product-carousel.stories.ts +12 -0
- package/template/stories/generated/split-content.stories.ts +12 -0
- package/template/stories/generated/trust-strip.stories.ts +8 -1
- package/template/stories/pages/article.stories.ts +2 -1
- package/template/stories/pages/cart.stories.ts +2 -1
- package/template/stories/pages/category.stories.ts +2 -1
- package/template/stories/pages/collection.stories.ts +2 -1
- package/template/stories/pages/home.stories.ts +2 -1
- package/template/stories/pages/product.stories.ts +2 -1
- package/template/stories/pages/products.stories.ts +2 -1
- package/template/stories/pages/search.stories.ts +2 -1
- package/template/stories/pages/wishlist.stories.ts +2 -1
- package/template/stories/support/demoChrome.ts +32 -0
- package/template/stories/support/pageBlocks.ts +2 -4
- package/template/test/countPill.browser.spec.ts +21 -13
- package/template/test/localePrefix.spec.ts +11 -6
- package/template/test/pages/article.spec.ts +1 -1
- package/template/test/pages/category.spec.ts +34 -11
- package/template/test/pages/collection.spec.ts +182 -148
- package/template/test/pages/home.spec.ts +35 -40
- package/template/test/pages/hydration.spec.ts +4 -4
- package/template/test/pages/product.spec.ts +17 -14
- package/template/test/pages/seededPages.spec.ts +11 -6
- package/template/test/prerenderRefresh.browser.spec.ts +36 -15
- package/template/test/previewParity.browser.spec.ts +36 -2
- package/template/test/starter.spec.ts +31 -15
- package/template/test/storefront/gatewayPrerender.spec.ts +26 -0
- package/template/tokens.json +13 -13
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
{
|
|
2
|
-
"announcement-bar": "
|
|
3
|
-
"article": "
|
|
4
|
-
"article-list": "
|
|
5
|
-
"breadcrumbs": "
|
|
6
|
-
"cart": "
|
|
7
|
-
"collection-grid": "
|
|
8
|
-
"collection-header": "
|
|
9
|
-
"contact": "
|
|
10
|
-
"cta": "
|
|
11
|
-
"faq": "
|
|
12
|
-
"feature-grid": "
|
|
13
|
-
"footer": "
|
|
14
|
-
"form": "
|
|
15
|
-
"gallery": "
|
|
16
|
-
"hero": "
|
|
17
|
-
"image": "
|
|
18
|
-
"logo-cloud": "
|
|
19
|
-
"navigation": "
|
|
20
|
-
"newsletter": "
|
|
21
|
-
"order-status": "
|
|
22
|
-
"pricing-table": "
|
|
23
|
-
"product-carousel": "
|
|
24
|
-
"product-detail": "
|
|
25
|
-
"quote": "
|
|
26
|
-
"rich-text": "
|
|
27
|
-
"search": "
|
|
28
|
-
"split-content": "
|
|
29
|
-
"stats": "
|
|
30
|
-
"tabs": "
|
|
31
|
-
"team": "
|
|
32
|
-
"testimonials": "
|
|
33
|
-
"timeline": "
|
|
34
|
-
"trust-strip": "
|
|
35
|
-
"video-embed": "
|
|
36
|
-
"wishlist": "
|
|
2
|
+
"announcement-bar": "57585e73344f7f93e035e0ad2b4dd6bb78a637938748fe3e3cc3a5be03f9dd2e",
|
|
3
|
+
"article": "a1547a989ef3d10050746285d4ce1c24b16e2610e2bd050dafa5c488c67af89a",
|
|
4
|
+
"article-list": "d3f44dd64ee22d9a0601d09a83796630102908a1ec6382de920438b0abab5a18",
|
|
5
|
+
"breadcrumbs": "d4c6ced656b44bf949c4e4ea227d92d3890ca4cbc655aa07660d60d3121e7e18",
|
|
6
|
+
"cart": "36f3bc9cb2d5344d23e5cba32e02a7f4406b516f1f67bd048940b5277aa366af",
|
|
7
|
+
"collection-grid": "ca49c57711dfdce4360fb71b625c7e09352b0e5aa906e511108221198e6b8ca4",
|
|
8
|
+
"collection-header": "84ccdb7fec7818e26c7380c54109c6bef6fd4220bca2881a495fa6c37498ba11",
|
|
9
|
+
"contact": "a5a8e88a33a067924dee514db34fabc75a041571174543c1f20a726d7d9dea97",
|
|
10
|
+
"cta": "e1971283c825fb8151ea021adb8342291dce7d0fb131cd3c523b4a214d91e629",
|
|
11
|
+
"faq": "b7300c859d2fbe9df7a530f023ac31217e2ce903e73ecf97420eaf2f5e412e1c",
|
|
12
|
+
"feature-grid": "fd3843fd1ec77463f2ba1aac882071febeb4ab6ff3942b167f7cfc78b60a1f0c",
|
|
13
|
+
"footer": "36921634f057d3c242d8af500e1c02bb2b7d5cd2496333de343f582f5b9c8c33",
|
|
14
|
+
"form": "6a8a93e671d828b43823b0f59d774f582e89df4d89aaba6494a1841cbe7998da",
|
|
15
|
+
"gallery": "ed4b5a8bf44ef89c105555d95863227ce17434cb42226bbc7872ec24b863cf09",
|
|
16
|
+
"hero": "d8a215c971ff457a249de48195c5cd01145254779dedb2f46665fe22c1071af2",
|
|
17
|
+
"image": "2a02bc00b716a913973fcdffcb27a393055ccdd5d2cc02b43c25d59c391a04a9",
|
|
18
|
+
"logo-cloud": "879e21642dd6af00c38dab6677367d7813ba6297dfba96c76c83c858dbb13fd2",
|
|
19
|
+
"navigation": "f819d25dd803e67b89309caf8c45242d32aa3917cbf4aa6efcb2177f9d50cebe",
|
|
20
|
+
"newsletter": "72df60e514a4409ed38df928ef1a2c3ad4593ebaaa436e283c492a91be183769",
|
|
21
|
+
"order-status": "c171b7f74e618d7df6f30b5bbbd4c440489a4e0a3783637738c92598b1d681e9",
|
|
22
|
+
"pricing-table": "fb5bc12b2ec9e945ee2d0a89c75104a181d0d5b50cff23bf44f9126cbe37bed7",
|
|
23
|
+
"product-carousel": "4e79a2f991af8a61865b369669a8da5abb60ef59d356cd1ef69da39b721433de",
|
|
24
|
+
"product-detail": "433cd3a66afa9c12f70b85a32c60325fca25f389c0df9a5a5747d6608c56dcb6",
|
|
25
|
+
"quote": "5b759a46d13182767cb7ec7000c5522dffebffc7d15b5875b0e6ed10a5d15f2e",
|
|
26
|
+
"rich-text": "3335be168a9da49e74975a5d08cb2bc7611e5352ae084f67847978641172ca5e",
|
|
27
|
+
"search": "7b3a1246e7f1fde145586bae58727915457a96fc99bf32256ea79739831a1dd3",
|
|
28
|
+
"split-content": "0809f4b9293ed1923674e1980985fb036ecd225b8e8ec4daf475c4993f3abd68",
|
|
29
|
+
"stats": "a20899c1e2276a2ca9dd506a37509f3184c4c59cac7599638ca0f3d4b5015211",
|
|
30
|
+
"tabs": "e0673e483c57e6240488a7c6977daed94b3de3a02b144535e720ac55de6e5c7d",
|
|
31
|
+
"team": "d94f9148f05f4891439cf20d92682ec8531528fbdea78df388cd9a63646e3d60",
|
|
32
|
+
"testimonials": "941e03c9f08aff291be1819a0aa6ea691471d1482bb86632be0b3c8f3d0f039b",
|
|
33
|
+
"timeline": "f289d4b847e8784fb2fcc0c50fceef3438472c94bdb6c866c31a6070fb84765b",
|
|
34
|
+
"trust-strip": "ea8ff8d5cdf05e46334badbc818d67115b99cf534a1bea9cf4f8852df35f82fc",
|
|
35
|
+
"video-embed": "db48fd9b3442c0195afdfe7adf48b9c7b2a6bb8a824bff7bdf44807a39867fb6",
|
|
36
|
+
"wishlist": "b214be4a302e780cfbb2b04f23fa1cd4f6dc5ca5ac65a03ec7a802825a80dfcd"
|
|
37
37
|
}
|
package/template/README.md
CHANGED
|
@@ -124,6 +124,38 @@ skipped heading level, unique ids across every block instance on the page, and t
|
|
|
124
124
|
page-level gate `docs/starter-kit.md`'s testing section describes. Use them as a starting point for
|
|
125
125
|
your own site's pages, or as a reference for how a set of blocks composes.
|
|
126
126
|
|
|
127
|
+
The fixtures are also what a first deploy seeds, so their header and footer carry no menu, links or
|
|
128
|
+
store details (`test/starter.spec.ts` holds them to it). The page stories fill those in from the
|
|
129
|
+
header's and footer's own demo data (`stories/support/demoChrome.ts`), so Storybook shows the theme
|
|
130
|
+
as a filled-in store.
|
|
131
|
+
|
|
132
|
+
## Where each page-builder feature lives
|
|
133
|
+
|
|
134
|
+
Every theme feature the page builder offers has a working example in this starter:
|
|
135
|
+
|
|
136
|
+
| Feature | Where |
|
|
137
|
+
| ------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
138
|
+
| Header and footer as reusable components (`@header` / `@footer` regions) | `blocks/navigation`, `blocks/footer`; the roles come from `pages/home.page.json` through `starterTemplateRoles()` in `app/templates.ts`, and every page fixture places them |
|
|
139
|
+
| Menus with sections, product cards, badges and "see all" links | `blocks/navigation/block.json` (`links` declares `tree.sections` and `cards`), drawn by `Block.vue` through `@eldrajs/ui`'s `NavMenu`; demo menu in `blocks/navigation/mock.json` / `preview.json` |
|
|
140
|
+
| Grouped menu children moved to sections (migration step) | `blocks/navigation/block.json`, `migrations` version 5: `groupsToSections` |
|
|
141
|
+
| Phone menu layout the merchant picks | `blocks/navigation` `drawerLayout` (`accordion` / `sections`) |
|
|
142
|
+
| Header info strip, labelled tools, a square mark for small phones | `blocks/navigation` `infoItems`, `brandMark`, `account` |
|
|
143
|
+
| Seeded route templates and static pages | `pages/*.page.json` and `app/templates.ts`; `/cart`, `/wishlist`, `/search`, `/products` are page seeds with their one block `required` |
|
|
144
|
+
| Form seeds | `app/formSeeds.ts`; rendered by `blocks/contact`, `blocks/newsletter`, `blocks/footer` |
|
|
145
|
+
| Design tokens a merchant can override in Studio | `tokens.json`, read by `app/assets/main.css` (the Northwind palette and type) |
|
|
146
|
+
| Theme texts a merchant can override or translate | `i18n/en-US.json`, `i18n/is-IS.json` |
|
|
147
|
+
| Shopping in more than one currency | `CurrencyPicker` in `blocks/navigation` (drawer on phones) and `blocks/footer`; prices through `app/storefront/money.ts` (see [Prices and the store currency](#prices-and-the-store-currency)) |
|
|
148
|
+
| Block slots | `blocks/hero/block.json` `slots` (see [Block slots](#block-slots)) |
|
|
149
|
+
| Variants a merchant switches between | e.g. `hero` `card`, `trust-strip` `numbered`, `feature-grid` `arched`, `collection-grid` `filter-bar`; Storybook draws one story per variant |
|
|
150
|
+
| Image fields with framing | hero, feature-grid, split-content, collection-header and product cards (`app/components/ui/UiImage.vue`) |
|
|
151
|
+
| Lightbox zoom | `blocks/product-detail/parts/Gallery.vue` (`zoom`) |
|
|
152
|
+
| A fixed header that does not widen when a dialog opens | `blocks/navigation/Block.vue`, `padding-right: var(--eldra-scrollbar-width)` on the fixed bar |
|
|
153
|
+
| Draft preview sessions and live/preview parity | runtime behaviour of `@eldrajs/theme-nuxt` (`docs/themes.md`); `test/previewParity.browser.spec.ts` proves a session renders these pages as the live site does. Off until the kit release that declares the capability (WS-1375) |
|
|
154
|
+
| `robots.txt` and `sitemap.xml` from the crawl settings | written by `@eldrajs/theme-nuxt` on a production build; nothing to add in the theme |
|
|
155
|
+
|
|
156
|
+
Not shown here: `Tabs` `size="sm"`/`fill` (meant for compact tool panels, not a storefront), and
|
|
157
|
+
`@eldrajs/nuxt`'s 404 for unbuilt paths, which would add a dependency to the starter.
|
|
158
|
+
|
|
127
159
|
## Storefront forms
|
|
128
160
|
|
|
129
161
|
Forms come from the platform: a merchant builds them on Studio's Forms page, and the `form` block
|
|
@@ -23,8 +23,31 @@
|
|
|
23
23
|
to this file. */
|
|
24
24
|
@source '../../blocks';
|
|
25
25
|
|
|
26
|
+
/* The theme's own look on top of the package defaults: colours come from `tokens.json` (Studio can
|
|
27
|
+
override those per site); type, shape and control size are set here because they are the
|
|
28
|
+
theme's design, not a merchant setting. Every value is one of the package's own `--eldra-*`
|
|
29
|
+
variables, so the prebuilt components pick it up with no class overrides.
|
|
30
|
+
|
|
31
|
+
Type uses system font stacks on purpose: a serif for headings and the platform sans for body
|
|
32
|
+
text. No web font is downloaded, so there is no layout shift and nothing to licence; a theme that
|
|
33
|
+
wants a brand face loads it and names it first in these two stacks. */
|
|
26
34
|
:root {
|
|
27
35
|
color-scheme: light;
|
|
36
|
+
--eldra-font-heading:
|
|
37
|
+
'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Charter, 'Bitstream Charter',
|
|
38
|
+
Georgia, serif;
|
|
39
|
+
--eldra-font-body:
|
|
40
|
+
system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
41
|
+
--eldra-text-display-weight: 500;
|
|
42
|
+
--eldra-text-display-tracking: -0.015em;
|
|
43
|
+
--eldra-text-h1-weight: 500;
|
|
44
|
+
--eldra-text-h1-tracking: -0.015em;
|
|
45
|
+
--eldra-text-h2-weight: 500;
|
|
46
|
+
--eldra-text-h2-tracking: -0.01em;
|
|
47
|
+
--eldra-text-h3-weight: 500;
|
|
48
|
+
--eldra-radius-xl: 1.25rem;
|
|
49
|
+
--eldra-control-height: 2.75rem;
|
|
50
|
+
--eldra-control-height-lg: 3.25rem;
|
|
28
51
|
}
|
|
29
52
|
|
|
30
53
|
/* Hides the native scrollbar on a scroll-snap carousel track while keeping
|
|
@@ -265,6 +265,9 @@ export default defineNuxtPlugin({
|
|
|
265
265
|
},
|
|
266
266
|
// Only the browser refreshes: on the server the read that just ran *is* the live value.
|
|
267
267
|
register: import.meta.client ? (entry) => refresher.register(entry) : undefined,
|
|
268
|
+
// A draft preview session's veil waits for the loads a draft's render starts
|
|
269
|
+
// (`@eldrajs/theme-nuxt`'s `holdPreviewSession`, a no-op outside a covered session).
|
|
270
|
+
hold: import.meta.client ? (load) => holdPreviewSession(load) : undefined,
|
|
268
271
|
};
|
|
269
272
|
|
|
270
273
|
source = createGatewayStorefront(client, {
|
|
@@ -58,12 +58,59 @@ import type {
|
|
|
58
58
|
const FREE_SHIPPING_THRESHOLD = 80; // $80.00
|
|
59
59
|
const FLAT_SHIPPING = 6; // $6.00, below the free-shipping threshold
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
/**
|
|
62
|
+
* The CC0 photos in `public/images/` (sources and authors in `public/images/CREDITS.md`), with
|
|
63
|
+
* their pixel size so an image reserves its box before it loads.
|
|
64
|
+
*/
|
|
65
|
+
const DEMO_PHOTOS = {
|
|
66
|
+
bowl: [1120, 1400],
|
|
67
|
+
'clay-hands': [1400, 933],
|
|
68
|
+
'coffee-table': [1400, 933],
|
|
69
|
+
cup: [1400, 952],
|
|
70
|
+
'enamel-cups': [1400, 933],
|
|
71
|
+
hero: [1400, 933],
|
|
72
|
+
kitchen: [1400, 840],
|
|
73
|
+
mug: [1400, 934],
|
|
74
|
+
planters: [932, 1400],
|
|
75
|
+
plates: [1400, 933],
|
|
76
|
+
reading: [1400, 933],
|
|
77
|
+
sweater: [1400, 933],
|
|
78
|
+
terracotta: [1400, 933],
|
|
79
|
+
throws: [1400, 910],
|
|
80
|
+
vase: [835, 1400],
|
|
81
|
+
wheel: [1400, 933],
|
|
82
|
+
'yarn-tools': [1400, 933],
|
|
83
|
+
yarn: [1400, 933],
|
|
84
|
+
} as const satisfies Record<string, readonly [number, number]>;
|
|
85
|
+
|
|
86
|
+
type DemoPhoto = keyof typeof DEMO_PHOTOS;
|
|
87
|
+
|
|
88
|
+
function demoImage(photo: DemoPhoto, alt: string): StorefrontMedia {
|
|
89
|
+
const [width, height] = DEMO_PHOTOS[photo];
|
|
90
|
+
return { src: `/images/${photo}.webp`, alt, width, height };
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Each product's photo and two more for its gallery. The photos are stock pictures chosen to
|
|
95
|
+
* sit near each product, not pictures of it: a real store's own product images replace them.
|
|
96
|
+
*/
|
|
97
|
+
const PRODUCT_PHOTOS: Record<string, readonly [DemoPhoto, DemoPhoto, DemoPhoto]> = {
|
|
98
|
+
'merino-crew-sweater': ['sweater', 'yarn', 'throws'],
|
|
99
|
+
'fisherman-rib-cardigan': ['yarn-tools', 'sweater', 'reading'],
|
|
100
|
+
'lambswool-throw-blanket': ['throws', 'reading', 'sweater'],
|
|
101
|
+
'ribbed-lambswool-beanie': ['yarn', 'yarn-tools', 'sweater'],
|
|
102
|
+
'linen-tea-towels-pair': ['enamel-cups', 'kitchen', 'cup'],
|
|
103
|
+
'speckled-latte-mug': ['mug', 'coffee-table', 'cup'],
|
|
104
|
+
'stoneware-dinner-plates-set-of-4': ['plates', 'kitchen', 'bowl'],
|
|
105
|
+
'walnut-serving-board': ['kitchen', 'plates', 'coffee-table'],
|
|
106
|
+
'hand-thrown-serving-bowl': ['bowl', 'clay-hands', 'wheel'],
|
|
107
|
+
'glazed-milk-jug': ['hero', 'terracotta', 'vase'],
|
|
108
|
+
'linen-napkins-set-of-4': ['cup', 'enamel-cups', 'kitchen'],
|
|
109
|
+
'stonewashed-linen-throw': ['reading', 'throws', 'yarn'],
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
function productPhotos(handle: string): readonly [DemoPhoto, DemoPhoto, DemoPhoto] {
|
|
113
|
+
return PRODUCT_PHOTOS[handle] ?? ['mug', 'plates', 'kitchen'];
|
|
67
114
|
}
|
|
68
115
|
|
|
69
116
|
// ---------------------------------------------------------------------------------------------
|
|
@@ -296,13 +343,13 @@ function registerAttributes(handle: string, def: DemoProductDef): void {
|
|
|
296
343
|
});
|
|
297
344
|
}
|
|
298
345
|
|
|
299
|
-
function buildListItem(def: DemoProductDef
|
|
346
|
+
function buildListItem(def: DemoProductDef): StorefrontProductListItem {
|
|
300
347
|
registerAttributes(def.handle, def);
|
|
301
348
|
return {
|
|
302
349
|
handle: def.handle,
|
|
303
350
|
title: def.title,
|
|
304
351
|
url: `/products/${def.handle}`,
|
|
305
|
-
featuredImage: demoImage(
|
|
352
|
+
featuredImage: demoImage(productPhotos(def.handle)[0], def.title),
|
|
306
353
|
price: { amount: def.amount, compareAt: def.compareAt ?? null },
|
|
307
354
|
rating: def.rating ?? null,
|
|
308
355
|
colours: def.colours,
|
|
@@ -360,13 +407,17 @@ const MERINO_OPTIONS: StorefrontProduct['options'] = [
|
|
|
360
407
|
}),
|
|
361
408
|
];
|
|
362
409
|
|
|
363
|
-
function buildFullProduct(def: DemoProductDef
|
|
364
|
-
const listItem = buildListItem(def
|
|
410
|
+
function buildFullProduct(def: DemoProductDef): StorefrontProduct {
|
|
411
|
+
const listItem = buildListItem(def);
|
|
365
412
|
const isMerino = def.handle === 'merino-crew-sweater';
|
|
366
413
|
return {
|
|
367
414
|
...listItem,
|
|
368
415
|
variantId: def.variantId,
|
|
369
|
-
images: [
|
|
416
|
+
images: [
|
|
417
|
+
demoImage(productPhotos(def.handle)[0], def.title),
|
|
418
|
+
demoImage(productPhotos(def.handle)[1], `${def.title}, alternate view`),
|
|
419
|
+
demoImage(productPhotos(def.handle)[2], `${def.title}, in use`),
|
|
420
|
+
],
|
|
370
421
|
options: isMerino ? MERINO_OPTIONS : [],
|
|
371
422
|
// Walked up the fixture's own tree from the product's category, exactly as
|
|
372
423
|
// `createGatewayStorefront` walks the store's: `Home / Ceramics` for a mug, `Knitwear` for a
|
|
@@ -382,7 +433,7 @@ function buildFullProduct(def: DemoProductDef, index: number): StorefrontProduct
|
|
|
382
433
|
}
|
|
383
434
|
|
|
384
435
|
const PRODUCTS_FULL: Record<string, StorefrontProduct> = Object.fromEntries(
|
|
385
|
-
PRODUCT_DEFS.map((def
|
|
436
|
+
PRODUCT_DEFS.map((def) => [def.handle, buildFullProduct(def)])
|
|
386
437
|
);
|
|
387
438
|
|
|
388
439
|
/** Every fixture product a volatile refresh could be asked about, by the id a card carries. */
|
|
@@ -459,7 +510,7 @@ const COLLECTIONS: Record<string, StorefrontCollectionInfo> = {
|
|
|
459
510
|
title: 'Winter knitwear',
|
|
460
511
|
description:
|
|
461
512
|
'Heavy-gauge knits for the coldest months, from our Portland studio and two family mills in Biella and the Scottish Borders.',
|
|
462
|
-
image: demoImage(
|
|
513
|
+
image: demoImage('sweater', 'Winter knitwear'),
|
|
463
514
|
productCount: 48,
|
|
464
515
|
},
|
|
465
516
|
'the-winter-edit': {
|
|
@@ -467,7 +518,7 @@ const COLLECTIONS: Record<string, StorefrontCollectionInfo> = {
|
|
|
467
518
|
title: 'The winter edit',
|
|
468
519
|
description:
|
|
469
520
|
'Heavy-gauge knits, stoneware for slow breakfasts and kitchen goods for the cold months, from our Portland studio and two family mills in Biella and the Scottish Borders.',
|
|
470
|
-
image: demoImage(
|
|
521
|
+
image: demoImage('throws', 'The winter edit'),
|
|
471
522
|
productCount: 48,
|
|
472
523
|
},
|
|
473
524
|
/**
|
|
@@ -480,7 +531,7 @@ const COLLECTIONS: Record<string, StorefrontCollectionInfo> = {
|
|
|
480
531
|
handle: 'best-sellers',
|
|
481
532
|
title: 'Best sellers',
|
|
482
533
|
description: 'The Northwind pieces shoppers reach for again and again.',
|
|
483
|
-
image: demoImage(
|
|
534
|
+
image: demoImage('mug', 'Best sellers'),
|
|
484
535
|
productCount: BEST_SELLER_HANDLES.length,
|
|
485
536
|
},
|
|
486
537
|
};
|
|
@@ -645,7 +696,7 @@ const ORDER_LINES: StorefrontCartLine[] = [
|
|
|
645
696
|
quantity: 1,
|
|
646
697
|
unitPrice: 148,
|
|
647
698
|
lineTotal: 148,
|
|
648
|
-
image: demoImage(
|
|
699
|
+
image: demoImage('sweater', 'Fell crew sweater'),
|
|
649
700
|
max: null,
|
|
650
701
|
},
|
|
651
702
|
{
|
|
@@ -658,7 +709,7 @@ const ORDER_LINES: StorefrontCartLine[] = [
|
|
|
658
709
|
quantity: 2,
|
|
659
710
|
unitPrice: 32,
|
|
660
711
|
lineTotal: 64,
|
|
661
|
-
image: demoImage(
|
|
712
|
+
image: demoImage('cup', 'Everyday mug'),
|
|
662
713
|
max: null,
|
|
663
714
|
},
|
|
664
715
|
{
|
|
@@ -671,7 +722,7 @@ const ORDER_LINES: StorefrontCartLine[] = [
|
|
|
671
722
|
quantity: 1,
|
|
672
723
|
unitPrice: 32,
|
|
673
724
|
lineTotal: 32,
|
|
674
|
-
image: demoImage(
|
|
725
|
+
image: demoImage('enamel-cups', 'Linen tea towels, set of 2'),
|
|
675
726
|
max: null,
|
|
676
727
|
},
|
|
677
728
|
];
|
|
@@ -795,21 +846,21 @@ const JOURNAL_ARTICLES: StorefrontSearchResponse['articles'] = [
|
|
|
795
846
|
href: '/journal/how-to-wash-and-store-linen',
|
|
796
847
|
category: 'Care guide',
|
|
797
848
|
readingTime: '4 min read',
|
|
798
|
-
image: demoImage(
|
|
849
|
+
image: demoImage('throws', 'How to wash and store linen'),
|
|
799
850
|
},
|
|
800
851
|
{
|
|
801
852
|
title: 'Linen vs. cotton for the kitchen',
|
|
802
853
|
href: '/journal/linen-vs-cotton-for-the-kitchen',
|
|
803
854
|
category: 'Journal',
|
|
804
855
|
readingTime: '6 min read',
|
|
805
|
-
image: demoImage(
|
|
856
|
+
image: demoImage('kitchen', 'Linen vs. cotton for the kitchen'),
|
|
806
857
|
},
|
|
807
858
|
{
|
|
808
859
|
title: 'A visit to the Kortrijk flax mill',
|
|
809
860
|
href: '/journal/a-visit-to-the-kortrijk-flax-mill',
|
|
810
861
|
category: 'Journal',
|
|
811
862
|
readingTime: '8 min read',
|
|
812
|
-
image: demoImage(
|
|
863
|
+
image: demoImage('yarn-tools', 'A visit to the Kortrijk flax mill'),
|
|
813
864
|
},
|
|
814
865
|
];
|
|
815
866
|
|
|
@@ -938,7 +989,7 @@ export const DEMO_CART_LINES: StorefrontCartLine[] = [
|
|
|
938
989
|
quantity: 1,
|
|
939
990
|
unitPrice: 96,
|
|
940
991
|
lineTotal: 96,
|
|
941
|
-
image: demoImage(
|
|
992
|
+
image: demoImage('sweater', 'Merino crew sweater'),
|
|
942
993
|
max: null,
|
|
943
994
|
},
|
|
944
995
|
{
|
|
@@ -951,7 +1002,7 @@ export const DEMO_CART_LINES: StorefrontCartLine[] = [
|
|
|
951
1002
|
quantity: 2,
|
|
952
1003
|
unitPrice: 28,
|
|
953
1004
|
lineTotal: 56,
|
|
954
|
-
image: demoImage(
|
|
1005
|
+
image: demoImage('mug', 'Speckled latte mug'),
|
|
955
1006
|
max: null,
|
|
956
1007
|
},
|
|
957
1008
|
{
|
|
@@ -964,7 +1015,7 @@ export const DEMO_CART_LINES: StorefrontCartLine[] = [
|
|
|
964
1015
|
quantity: 1,
|
|
965
1016
|
unitPrice: 58,
|
|
966
1017
|
lineTotal: 58,
|
|
967
|
-
image: demoImage(
|
|
1018
|
+
image: demoImage('kitchen', 'Walnut serving board'),
|
|
968
1019
|
max: null,
|
|
969
1020
|
},
|
|
970
1021
|
];
|
|
@@ -891,6 +891,13 @@ export interface StorefrontRuntime {
|
|
|
891
891
|
prerender?<T>(key: string, load: () => Promise<T | null>): StorefrontPrerenderHandle<T> | null;
|
|
892
892
|
/** Takes the result into the page's one batched volatile refresh (`refresh.ts`). */
|
|
893
893
|
register?(entry: VolatileRefreshEntry): void;
|
|
894
|
+
/**
|
|
895
|
+
* Hands over every load a result starts, settled once its answer is written. A draft preview
|
|
896
|
+
* session keeps its veil up for the ones started while it is covered (`holdPreviewSession`), so
|
|
897
|
+
* a block whose draft names a collection the pinned build never read is shown with its answer,
|
|
898
|
+
* not with the skeleton it has for the moment that read takes.
|
|
899
|
+
*/
|
|
900
|
+
hold?(load: Promise<void>): void;
|
|
894
901
|
}
|
|
895
902
|
|
|
896
903
|
export interface StorefrontPrerenderHandle<T> {
|
|
@@ -1067,7 +1074,14 @@ function createGatewayResult<T>(
|
|
|
1067
1074
|
}
|
|
1068
1075
|
}
|
|
1069
1076
|
|
|
1070
|
-
|
|
1077
|
+
/** Every load, handed to the runtime as well (`StorefrontRuntime.hold`). */
|
|
1078
|
+
function run(): Promise<void> {
|
|
1079
|
+
const loaded = load();
|
|
1080
|
+
options.runtime?.hold?.(loaded);
|
|
1081
|
+
return loaded;
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
watch(options.currency === undefined ? sources : [...sources, options.currency], run, {
|
|
1071
1085
|
immediate: true,
|
|
1072
1086
|
deep: true,
|
|
1073
1087
|
});
|
|
@@ -1092,7 +1106,7 @@ function createGatewayResult<T>(
|
|
|
1092
1106
|
options.runtime.register(entry);
|
|
1093
1107
|
}
|
|
1094
1108
|
|
|
1095
|
-
return { data, pending, loading, error, revalidating, refresh:
|
|
1109
|
+
return { data, pending, loading, error, revalidating, refresh: run };
|
|
1096
1110
|
}
|
|
1097
1111
|
|
|
1098
1112
|
// ---------------------------------------------------------------------------------------------
|
|
Binary file
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"coverImage": {
|
|
3
3
|
"assetId": "demo-article-cover",
|
|
4
|
-
"url": "/
|
|
5
|
-
"altText": "
|
|
6
|
-
"width":
|
|
7
|
-
"height":
|
|
4
|
+
"url": "/images/reading.webp",
|
|
5
|
+
"altText": "Reading under a wool blanket",
|
|
6
|
+
"width": 1400,
|
|
7
|
+
"height": 933
|
|
8
8
|
},
|
|
9
9
|
"authorAvatar": {
|
|
10
10
|
"assetId": "demo-avatar-6",
|
|
Binary file
|
|
@@ -185,6 +185,12 @@ interface CardView {
|
|
|
185
185
|
readingTime: string | null;
|
|
186
186
|
image: { src: string; alt: string; width?: number; height?: number } | null;
|
|
187
187
|
featured: boolean;
|
|
188
|
+
/**
|
|
189
|
+
* "At home · 4 min read": the category and the reading time, the small line above the title. Two
|
|
190
|
+
* nodes, each value exactly as stored: Studio finds a field to edit inline by its value, one per
|
|
191
|
+
* text node, so a joined string would leave the reading time uneditable.
|
|
192
|
+
*/
|
|
193
|
+
kicker: string[];
|
|
188
194
|
}
|
|
189
195
|
|
|
190
196
|
const cards = computed<CardView[]>(() =>
|
|
@@ -202,38 +208,60 @@ const cards = computed<CardView[]>(() =>
|
|
|
202
208
|
readingTime: (item.readingTime ?? '').trim() || null,
|
|
203
209
|
image: media ? { src: media.url, alt: '', width: media.width, height: media.height } : null,
|
|
204
210
|
featured: isFeaturedFirst.value && index === 0,
|
|
211
|
+
kicker: [item.categoryLabel, item.readingTime].filter(
|
|
212
|
+
(part): part is string => typeof part === 'string' && part.trim() !== ''
|
|
213
|
+
),
|
|
205
214
|
};
|
|
206
215
|
})
|
|
207
216
|
);
|
|
208
217
|
|
|
209
|
-
/**
|
|
210
|
-
|
|
211
|
-
|
|
218
|
+
/**
|
|
219
|
+
* The theme's journal card, on every variant (`ContentCard` restyled through `classes`, never
|
|
220
|
+
* forked): the category and reading time as one small muted line *above* the title (the card's
|
|
221
|
+
* `eyebrow` part, its overline look undone), the title in the heading serif at 1.375rem, weight
|
|
222
|
+
* 500, not underlined until hover, and a 0.75rem rhythm. The date, when a story has one, stays in
|
|
223
|
+
* the card's own meta line under the title.
|
|
224
|
+
*/
|
|
225
|
+
const NO_UNDERLINE_UNTIL_HOVER =
|
|
226
|
+
'no-underline group-hover:underline group-hover:decoration-1 group-hover:decoration-current ' +
|
|
227
|
+
'group-hover:underline-offset-[0.2em]';
|
|
228
|
+
const BASE_CARD_CLASSES: Partial<Record<ContentCardPart, string>> = {
|
|
229
|
+
body: 'gap-1.5',
|
|
230
|
+
eyebrow: 'text-muted text-[0.8125rem] leading-[1.4] font-normal normal-case tracking-[0.04em]',
|
|
231
|
+
title: 'font-heading text-[1.375rem] leading-[1.25] font-medium tracking-normal',
|
|
232
|
+
titleLink: NO_UNDERLINE_UNTIL_HOVER,
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
/** Static, variant-keyed class lookups (Tailwind cannot see a dynamically built class name). One
|
|
236
|
+
* column until 961px of block width, three from there. */
|
|
237
|
+
const GRID_ROOT_CLASS = 'grid grid-cols-1 gap-8 @min-[60.0625rem]:grid-cols-3';
|
|
212
238
|
const LIST_ROOT_CLASS = 'flex flex-col border-t border-border';
|
|
213
239
|
const listContainerClass = computed(() => (isList.value ? LIST_ROOT_CLASS : GRID_ROOT_CLASS));
|
|
214
240
|
|
|
215
241
|
const FEATURED_CARD_CLASS =
|
|
216
242
|
'grid gap-6 @tablet:grid-cols-[7fr_5fr] @tablet:items-center @tablet:gap-8 @content:gap-12';
|
|
217
243
|
const FEATURED_CARD_CLASSES: Partial<Record<ContentCardPart, string>> = {
|
|
218
|
-
|
|
219
|
-
|
|
244
|
+
...BASE_CARD_CLASSES,
|
|
245
|
+
title: `${BASE_CARD_CLASSES.title} @content:text-[2rem] @content:leading-[1.15]`,
|
|
246
|
+
body: 'gap-1.5 @content:gap-3',
|
|
220
247
|
};
|
|
221
248
|
const LIST_CARD_CLASS =
|
|
222
249
|
'grid grid-cols-[6.5rem_1fr] items-start gap-4 @tablet:grid-cols-[15rem_1fr] @tablet:items-center @tablet:gap-8';
|
|
223
250
|
const LIST_CARD_CLASSES: Partial<Record<ContentCardPart, string>> = {
|
|
251
|
+
...BASE_CARD_CLASSES,
|
|
224
252
|
excerpt: '@max-tablet:hidden',
|
|
225
253
|
};
|
|
226
254
|
|
|
227
|
-
function cardClass(card: CardView): string
|
|
255
|
+
function cardClass(card: CardView): string {
|
|
228
256
|
if (card.featured) return FEATURED_CARD_CLASS;
|
|
229
257
|
if (isList.value) return LIST_CARD_CLASS;
|
|
230
|
-
return
|
|
258
|
+
return 'gap-3';
|
|
231
259
|
}
|
|
232
260
|
|
|
233
|
-
function cardClasses(card: CardView): Partial<Record<ContentCardPart, string>>
|
|
261
|
+
function cardClasses(card: CardView): Partial<Record<ContentCardPart, string>> {
|
|
234
262
|
if (card.featured) return FEATURED_CARD_CLASSES;
|
|
235
263
|
if (isList.value) return LIST_CARD_CLASSES;
|
|
236
|
-
return
|
|
264
|
+
return BASE_CARD_CLASSES;
|
|
237
265
|
}
|
|
238
266
|
|
|
239
267
|
function itemWrapperClass(card: CardView): string {
|
|
@@ -244,15 +272,12 @@ function itemWrapperClass(card: CardView): string {
|
|
|
244
272
|
|
|
245
273
|
<template>
|
|
246
274
|
<Section spacing="md" :labelled-by="hasHeading ? headingId : undefined">
|
|
247
|
-
<Container width="
|
|
248
|
-
<div
|
|
249
|
-
v-if="hasHead"
|
|
250
|
-
class="@tablet:flex-row @tablet:items-baseline @tablet:justify-between mb-6 flex flex-col items-start gap-2"
|
|
251
|
-
>
|
|
275
|
+
<Container width="wide">
|
|
276
|
+
<div v-if="hasHead" class="mb-8 flex flex-wrap items-end justify-between gap-x-8 gap-y-3">
|
|
252
277
|
<h2
|
|
253
278
|
v-if="hasHeading"
|
|
254
279
|
:id="headingId"
|
|
255
|
-
class="font-heading text-text
|
|
280
|
+
class="font-heading text-text text-[1.75rem] leading-[1.1] font-medium tracking-[-0.01em] text-balance @min-[47.5625rem]:text-[2.25rem]"
|
|
256
281
|
>
|
|
257
282
|
{{ heading }}
|
|
258
283
|
</h2>
|
|
@@ -269,7 +294,7 @@ function itemWrapperClass(card: CardView): string {
|
|
|
269
294
|
:as="viewAllLinkAs"
|
|
270
295
|
variant="standalone"
|
|
271
296
|
arrow
|
|
272
|
-
|
|
297
|
+
:underline="false"
|
|
273
298
|
>
|
|
274
299
|
{{ viewAllLabel }}
|
|
275
300
|
</Link>
|
|
@@ -306,14 +331,18 @@ function itemWrapperClass(card: CardView): string {
|
|
|
306
331
|
:link-as="card.linkAs"
|
|
307
332
|
:image="card.image"
|
|
308
333
|
ratio="3x2"
|
|
309
|
-
:eyebrow="card.categoryLabel"
|
|
310
334
|
:date="card.publishedAt"
|
|
311
|
-
:meta="card.readingTime"
|
|
312
335
|
:excerpt="card.dek"
|
|
313
336
|
:heading-level="3"
|
|
314
337
|
:class="cardClass(card)"
|
|
315
338
|
:classes="cardClasses(card)"
|
|
316
|
-
|
|
339
|
+
>
|
|
340
|
+
<template v-if="card.kicker.length > 0" #eyebrow>
|
|
341
|
+
<template v-for="(part, index) in card.kicker" :key="index">
|
|
342
|
+
<span v-if="index > 0" aria-hidden="true"> · </span><span>{{ part }}</span>
|
|
343
|
+
</template>
|
|
344
|
+
</template>
|
|
345
|
+
</ContentCard>
|
|
317
346
|
</li>
|
|
318
347
|
</ul>
|
|
319
348
|
<EditorPlaceholder
|
|
@@ -94,6 +94,21 @@ describe('article-list block', () => {
|
|
|
94
94
|
});
|
|
95
95
|
});
|
|
96
96
|
|
|
97
|
+
it('puts "category · reading time" on one line above each title, and the date under it', async () => {
|
|
98
|
+
const wrapper = mountBlock(withImages);
|
|
99
|
+
await flushPromises();
|
|
100
|
+
const articles = wrapper.findAll('article');
|
|
101
|
+
articles.forEach((article, index) => {
|
|
102
|
+
const item = withImages.items[index]!;
|
|
103
|
+
const kicker = article.get('[data-part="eyebrow"]');
|
|
104
|
+
expect(kicker.text()).toBe(`${item.categoryLabel} · ${item.readingTime}`);
|
|
105
|
+
const html = article.html();
|
|
106
|
+
expect(html.indexOf('data-part="eyebrow"')).toBeLessThan(html.indexOf('data-part="title"'));
|
|
107
|
+
expect(article.get('[data-part="meta"] time').attributes('datetime')).toBe(item.publishedAt);
|
|
108
|
+
expect(article.get('[data-part="meta"]').text()).not.toContain(item.readingTime);
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
|
|
97
112
|
it('renders card images as decorative (alt="")', async () => {
|
|
98
113
|
const wrapper = mountBlock(withImages);
|
|
99
114
|
await flushPromises();
|