spoko-design-system 1.21.1 → 1.22.0

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 CHANGED
@@ -1,3 +1,9 @@
1
+ ## [1.22.0](https://github.com/polo-blue/sds/compare/v1.21.1...v1.22.0) (2025-12-15)
2
+
3
+ ### Features
4
+
5
+ * **category:** add withMicrodata prop to control Schema.org rendering ([95c96cd](https://github.com/polo-blue/sds/commit/95c96cd71ec15a233432abec2d0c0f109ccd8f5d))
6
+
1
7
  ## [1.21.1](https://github.com/polo-blue/sds/compare/v1.21.0...v1.21.1) (2025-12-15)
2
8
 
3
9
  ### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spoko-design-system",
3
- "version": "1.21.1",
3
+ "version": "1.22.0",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "main": "./index.ts",
@@ -1,5 +1,5 @@
1
1
  ---
2
- const { activeCategorySlug, class: className } = Astro.props;
2
+ const { activeCategorySlug, class: className, withMicrodata = true } = Astro.props;
3
3
 
4
4
  import { getTranslatedLink } from '@utils/text/getTranslatedLink';
5
5
  import { getMainCategoryList } from '@utils/category/getMainCategoryList';
@@ -10,6 +10,22 @@ const imgDomain = 'https://api.polo.blue/img/';
10
10
 
11
11
  const activeIndex =
12
12
  activeCategorySlug && categories ? categories.map(a => a.slug).findIndex(e => e === activeCategorySlug) : 0;
13
+
14
+ // Microdata attributes - only added when withMicrodata is true
15
+ const containerMicrodata = withMicrodata
16
+ ? {
17
+ itemscope: true,
18
+ itemtype: 'https://schema.org/SiteNavigationElement',
19
+ }
20
+ : {};
21
+
22
+ const slideMicrodata = withMicrodata
23
+ ? {
24
+ itemprop: 'hasPart',
25
+ itemscope: true,
26
+ itemtype: 'https://schema.org/SiteNavigationElement',
27
+ }
28
+ : {};
13
29
  ---
14
30
 
15
31
  <!-- <div class={`cat-menu ${className ? className : ''}`}
@@ -21,8 +37,7 @@ const activeIndex =
21
37
  <swiper-container
22
38
  class={`categories-carousel flex pb-1 sm:pb-0 bg-white cat-menu ${className ? className : ''}`}
23
39
  data-pagefind-ignore
24
- itemscope
25
- itemtype="https://schema.org/SiteNavigationElement"
40
+ {...containerMicrodata}
26
41
  transition:persist={`catcarousel${activeIndex}`}
27
42
  transition:animate="none"
28
43
  data-active={activeIndex}
@@ -39,13 +54,15 @@ const activeIndex =
39
54
  {
40
55
  categories.map(category => (
41
56
  <swiper-slide
42
- itemprop="hasPart"
43
- itemscope
44
- itemtype="https://schema.org/SiteNavigationElement"
57
+ {...slideMicrodata}
45
58
  role="presentation"
46
59
  class={`swiper-slide cats-slide group ${category.slug === activeCategorySlug ? 'active' : ''}`}
47
60
  >
48
- <a itemprop="url" href={getTranslatedLink(`/${category.slug}/`)} class="carousel-item">
61
+ <a
62
+ {...(withMicrodata ? { itemprop: 'url' } : {})}
63
+ href={getTranslatedLink(`/${category.slug}/`)}
64
+ class="carousel-item"
65
+ >
49
66
  <Image
50
67
  src={`${imgDomain}${category.photo}`}
51
68
  alt={category.name}
@@ -58,7 +75,7 @@ const activeIndex =
58
75
  />
59
76
  <div class="swiper-lazy-preloader" />
60
77
 
61
- <div class="cat-name" itemprop="name">
78
+ <div class="cat-name" {...(withMicrodata ? { itemprop: 'name' } : {})}>
62
79
  {category.name}
63
80
  </div>
64
81
  </a>