spoko-design-system 1.8.1 → 1.9.1
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/settings.json +1 -1
- package/CHANGELOG.md +35 -0
- package/index.ts +8 -2
- package/package.json +4 -3
- package/src/components/Product/ProductEngine.astro +67 -0
- package/src/components/Product/ProductEngines.astro +43 -0
- package/src/pages/components/product-engine.mdx +75 -31
- package/src/pages/index.astro +108 -209
- package/src/scripts/tooltips.ts +33 -28
- package/src/styles/main.css +4 -0
- package/src/utils/product/getEngineTooltipContent.ts +163 -0
- package/uno-config/index.ts +1 -1
- package/src/components/Product/ProductEngine.vue +0 -240
- package/src/components/Product/ProductEngines.vue +0 -116
package/.claude/settings.json
CHANGED
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
"Bash(git log:*)",
|
|
15
15
|
"Bash(git add:*)",
|
|
16
16
|
"Bash(git commit:*)"
|
|
17
|
+
"Bash(git push:*)"
|
|
17
18
|
],
|
|
18
19
|
"deny": [
|
|
19
20
|
"Bash(pnpm semantic-release:*)",
|
|
20
21
|
"Bash(pnpm publish:*)",
|
|
21
22
|
"Bash(npm publish:*)",
|
|
22
|
-
"Bash(git push:*)"
|
|
23
23
|
],
|
|
24
24
|
"ask": [
|
|
25
25
|
"Bash(rm:*)",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,38 @@
|
|
|
1
|
+
## [1.9.1](https://github.com/polo-blue/sds/compare/v1.9.0...v1.9.1) (2025-10-30)
|
|
2
|
+
|
|
3
|
+
### ⚠ BREAKING CHANGES
|
|
4
|
+
|
|
5
|
+
* ProductEngine and ProductEngines are now Astro components
|
|
6
|
+
|
|
7
|
+
Replace Vue components with Astro for better performance and SEO:
|
|
8
|
+
- Convert ProductEngine.vue to ProductEngine.astro (SSR-friendly)
|
|
9
|
+
- Convert ProductEngines.vue to ProductEngines.astro
|
|
10
|
+
- Add getEngineTooltipContent utility for tooltip generation
|
|
11
|
+
- Create global tooltip delegation script for performance
|
|
12
|
+
- Add tippy.js CSS to main.css (tippy.css + tippy-theme.css)
|
|
13
|
+
|
|
14
|
+
Benefits:
|
|
15
|
+
- Engine codes now in HTML for SEO (no client-side hydration)
|
|
16
|
+
- 1 global script handles all tooltips via delegation pattern
|
|
17
|
+
- Tooltips created on-demand when hovered (not on mount)
|
|
18
|
+
- Works for both engine codes and PR codes
|
|
19
|
+
- Massive performance improvement on pages with many engines
|
|
20
|
+
|
|
21
|
+
Migration:
|
|
22
|
+
- Remove client:load directive from ProductEngines usage
|
|
23
|
+
- Import and call initTooltips() in your layout
|
|
24
|
+
- ProductEngine/ProductEngines now pure Astro (no Vue)
|
|
25
|
+
|
|
26
|
+
### Code Refactoring
|
|
27
|
+
|
|
28
|
+
* migrate ProductEngine from Vue to Astro with tooltip delegation ([b3589cc](https://github.com/polo-blue/sds/commit/b3589cc75da9cbf514bcffce2d06a8a36d67012e))
|
|
29
|
+
|
|
30
|
+
## [1.9.0](https://github.com/polo-blue/sds/compare/v1.8.1...v1.9.0) (2025-10-29)
|
|
31
|
+
|
|
32
|
+
### Features
|
|
33
|
+
|
|
34
|
+
* **homepage:** refactor to use config-driven loops and responsive typography ([d97c659](https://github.com/polo-blue/sds/commit/d97c659e0e30d0a79234d8868371edac290608cf))
|
|
35
|
+
|
|
1
36
|
## [1.8.1](https://github.com/polo-blue/sds/compare/v1.8.0...v1.8.1) (2025-10-29)
|
|
2
37
|
|
|
3
38
|
### Bug Fixes
|
package/index.ts
CHANGED
|
@@ -19,8 +19,7 @@ export { default as Headline } from './src/components/Headline.vue';
|
|
|
19
19
|
export { default as Quote } from './src/components/Quote.vue';
|
|
20
20
|
|
|
21
21
|
export { default as ProductEngineType } from './src/components/Product/ProductEngineType.vue';
|
|
22
|
-
|
|
23
|
-
export { default as ProductEngines } from './src/components/Product/ProductEngines.vue';
|
|
22
|
+
// ProductEngine and ProductEngines are now Astro components (see Astro Components section below)
|
|
24
23
|
export { default as ProductButton } from './src/components/Product/ProductButton.vue';
|
|
25
24
|
export { default as ProductColors } from './src/components/Product/ProductColors.vue';
|
|
26
25
|
export { default as ProductDetailName } from './src/components/Product/ProductDetailName.vue';
|
|
@@ -50,6 +49,8 @@ export { default as ButtonCopy } from './src/components/ButtonCopy.astro';
|
|
|
50
49
|
export { default as CallToAction } from './src/components/Layout/CallToAction.astro';
|
|
51
50
|
|
|
52
51
|
export { default as ProductImage } from './src/components/Product/ProductImage.astro';
|
|
52
|
+
export { default as ProductEngine } from './src/components/Product/ProductEngine.astro';
|
|
53
|
+
export { default as ProductEngines } from './src/components/Product/ProductEngines.astro';
|
|
53
54
|
|
|
54
55
|
export { default as CategoryDetails } from './src/components/Category/CategoryDetails.astro';
|
|
55
56
|
export { default as CategoryTile } from './src/components/Category/CategoryTile.astro';
|
|
@@ -58,6 +59,8 @@ export { default as CategoryTile } from './src/components/Category/CategoryTile.
|
|
|
58
59
|
// Utils: Product
|
|
59
60
|
export { default as getPriceFormatted } from './src/utils/product/getPriceFormatted';
|
|
60
61
|
export { default as getProductChecklist } from './src/utils/product/getProductChecklist';
|
|
62
|
+
export { getEngineTooltipContent } from './src/utils/product/getEngineTooltipContent';
|
|
63
|
+
export type { Engine, EngineTranslations } from './src/utils/product/getEngineTooltipContent';
|
|
61
64
|
|
|
62
65
|
// Utils: SEO
|
|
63
66
|
export { default as getShorterDescription } from './src/utils/seo/getShorterDescription';
|
|
@@ -70,3 +73,6 @@ export { default as formatLocaleNumber } from './src/utils/text/formatLocaleNumb
|
|
|
70
73
|
export { default as formatPad } from './src/utils/text/formatPad';
|
|
71
74
|
export { default as getNumberFormatted } from './src/utils/text/getNumberFormatted';
|
|
72
75
|
export { default as getTranslatedLink } from './src/utils/text/getTranslatedLink';
|
|
76
|
+
|
|
77
|
+
// Scripts
|
|
78
|
+
export { initTooltips } from './src/scripts/tooltips';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spoko-design-system",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "./index.ts",
|
|
6
6
|
"module": "./index.ts",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"spoko design system"
|
|
53
53
|
],
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@algolia/client-search": "^5.
|
|
55
|
+
"@algolia/client-search": "^5.42.0",
|
|
56
56
|
"@astrojs/mdx": "^4.3.9",
|
|
57
57
|
"@astrojs/node": "^9.5.0",
|
|
58
58
|
"@astrojs/sitemap": "^3.6.0",
|
|
@@ -145,7 +145,8 @@
|
|
|
145
145
|
},
|
|
146
146
|
"ignoredBuiltDependencies": [
|
|
147
147
|
"esbuild",
|
|
148
|
-
"sharp"
|
|
148
|
+
"sharp",
|
|
149
|
+
"vue-demi"
|
|
149
150
|
]
|
|
150
151
|
},
|
|
151
152
|
"engines": {
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { getEngineTooltipContent } from '../../utils/product/getEngineTooltipContent';
|
|
3
|
+
import type { Engine, EngineTranslations } from '../../utils/product/getEngineTooltipContent';
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
VAG group (VW/Audi/Skoda/Seat/Porsche/Bentley/Lamborghini/Ducati/Cupra/Scania/MAN) manufacturer Engine Code
|
|
7
|
+
Displays engine code with detailed tooltip showing: name, power, displacement, dates, etc.
|
|
8
|
+
|
|
9
|
+
SEO-friendly: Engine code is rendered in HTML, tooltips enhanced via delegation script
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
interface Props {
|
|
13
|
+
engine: Engine;
|
|
14
|
+
showComma?: boolean;
|
|
15
|
+
translations?: EngineTranslations;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const { engine, showComma = false, translations = {} } = Astro.props;
|
|
19
|
+
|
|
20
|
+
// Generate tooltip content for data attribute
|
|
21
|
+
const tooltipContent = getEngineTooltipContent(engine, translations);
|
|
22
|
+
|
|
23
|
+
// Escape quotes for HTML attribute
|
|
24
|
+
const tooltipContentEscaped = tooltipContent.replace(/"/g, '"');
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
<span
|
|
28
|
+
class="engine-code"
|
|
29
|
+
class:list={[`engine-code-${engine.code}`]}
|
|
30
|
+
data-tippy-content={tooltipContentEscaped}
|
|
31
|
+
>
|
|
32
|
+
{engine.code}{showComma && ','}
|
|
33
|
+
</span>
|
|
34
|
+
|
|
35
|
+
<style>
|
|
36
|
+
/* Engine Code Styles */
|
|
37
|
+
.engine-code {
|
|
38
|
+
@apply inline-block mr-1;
|
|
39
|
+
@apply underline decoration-dotted underline-offset-4 py-0.5;
|
|
40
|
+
@apply decoration-neutral-light cursor-default;
|
|
41
|
+
@apply transition-colors duration-200;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.engine-code:hover {
|
|
45
|
+
@apply decoration-blue-darker dark:decoration-blue-light;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* Semantic Engine Code Colors */
|
|
49
|
+
/* GTI Engines - Red */
|
|
50
|
+
.engine-code-CAVE,
|
|
51
|
+
.engine-code-CTHE,
|
|
52
|
+
.engine-code-DAJA,
|
|
53
|
+
.engine-code-DAYB {
|
|
54
|
+
@apply text-red-600 dark:text-red-500;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* WRC R Engine - Blue */
|
|
58
|
+
.engine-code-CDLJ {
|
|
59
|
+
@apply text-blue-600 dark:text-blue-500;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/* Special Blue Engines */
|
|
63
|
+
.engine-code-CPTA,
|
|
64
|
+
.engine-code-CZEA {
|
|
65
|
+
@apply text-blue-700 dark:text-blue-600;
|
|
66
|
+
}
|
|
67
|
+
</style>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
import ProductEngine from './ProductEngine.astro';
|
|
3
|
+
import type { Engine, EngineTranslations } from '../../utils/product/getEngineTooltipContent';
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
ProductEngines wrapper component
|
|
7
|
+
Displays a list of engine codes with tooltips
|
|
8
|
+
SEO-friendly: All engine codes rendered in HTML, enhanced by global delegation script
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
interface Props {
|
|
12
|
+
engines: Engine[];
|
|
13
|
+
isPdp?: boolean;
|
|
14
|
+
translations?: EngineTranslations;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const { engines = [], isPdp = false, translations = {} } = Astro.props;
|
|
18
|
+
|
|
19
|
+
// Sort engines by code
|
|
20
|
+
const sortedEngines = engines.length
|
|
21
|
+
? [...engines].sort((a, b) => (a.code || '').localeCompare(b.code || ''))
|
|
22
|
+
: [];
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
{
|
|
26
|
+
sortedEngines.length > 0 && (
|
|
27
|
+
<div class="engines-list inline-flex flex-wrap items-center gap-x-0.5">
|
|
28
|
+
{sortedEngines.map((engine, index) => (
|
|
29
|
+
<ProductEngine
|
|
30
|
+
engine={engine}
|
|
31
|
+
showComma={index !== sortedEngines.length - 1}
|
|
32
|
+
translations={translations}
|
|
33
|
+
/>
|
|
34
|
+
))}
|
|
35
|
+
</div>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
<style>
|
|
40
|
+
.engines-list {
|
|
41
|
+
@apply leading-none;
|
|
42
|
+
}
|
|
43
|
+
</style>
|
|
@@ -2,28 +2,46 @@
|
|
|
2
2
|
title: "ProductEngine"
|
|
3
3
|
layout: "../../layouts/MainLayout.astro"
|
|
4
4
|
---
|
|
5
|
-
import ProductEngine from '../../components/Product/ProductEngine.
|
|
6
|
-
import ProductEngines from '../../components/Product/ProductEngines.
|
|
5
|
+
import ProductEngine from '../../components/Product/ProductEngine.astro'
|
|
6
|
+
import ProductEngines from '../../components/Product/ProductEngines.astro'
|
|
7
7
|
|
|
8
8
|
# ProductEngine
|
|
9
9
|
|
|
10
10
|
Engine codes with detailed tooltips showing specifications like power, displacement, dates, and more.
|
|
11
11
|
|
|
12
|
+
**⚡ Performance-optimized**: Uses Tippy.js delegation pattern - one global script handles all tooltips efficiently.
|
|
13
|
+
|
|
14
|
+
**🔍 SEO-friendly**: Engine codes rendered as static HTML (no client-side hydration required).
|
|
15
|
+
|
|
12
16
|
## Single Engine Code
|
|
13
17
|
|
|
14
18
|
Display a single engine code with tooltip showing detailed engine information.
|
|
15
19
|
|
|
16
|
-
###
|
|
20
|
+
### Setup:
|
|
21
|
+
|
|
22
|
+
**1. Import the component:**
|
|
17
23
|
|
|
18
24
|
```js
|
|
19
|
-
import ProductEngine from 'spoko-design-system
|
|
25
|
+
import { ProductEngine } from 'spoko-design-system'
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**2. Initialize tooltips in your layout (once):**
|
|
29
|
+
|
|
30
|
+
```astro
|
|
31
|
+
---
|
|
32
|
+
// In your layout file (e.g., Layout.astro)
|
|
33
|
+
---
|
|
34
|
+
<script>
|
|
35
|
+
import { initTooltips } from 'spoko-design-system';
|
|
36
|
+
initTooltips();
|
|
37
|
+
</script>
|
|
20
38
|
```
|
|
21
39
|
|
|
22
40
|
### Basic Usage (New API Structure):
|
|
23
41
|
|
|
24
42
|
<div class="component-preview">
|
|
25
43
|
<div class="bg-white p-6 w-full flex gap-2">
|
|
26
|
-
<ProductEngine
|
|
44
|
+
<ProductEngine engine={{
|
|
27
45
|
code: "CAYA",
|
|
28
46
|
name: "1.6 TDI",
|
|
29
47
|
serie: { value: "EA189", label: "Seria silnika" },
|
|
@@ -31,7 +49,7 @@ import ProductEngine from 'spoko-design-system/src/components/Product/ProductEng
|
|
|
31
49
|
displacement: { value: 1598, label: "Pojemność" },
|
|
32
50
|
euro: { value: 5, label: "Norma Euro" }
|
|
33
51
|
}} />
|
|
34
|
-
<ProductEngine
|
|
52
|
+
<ProductEngine engine={{
|
|
35
53
|
code: "CAYB",
|
|
36
54
|
name: "1.6 TDI",
|
|
37
55
|
serie: { value: "EA189", label: "Seria silnika" },
|
|
@@ -42,21 +60,25 @@ import ProductEngine from 'spoko-design-system/src/components/Product/ProductEng
|
|
|
42
60
|
</div>
|
|
43
61
|
</div>
|
|
44
62
|
|
|
45
|
-
```
|
|
63
|
+
```astro
|
|
64
|
+
---
|
|
65
|
+
import { ProductEngine } from 'spoko-design-system';
|
|
66
|
+
---
|
|
67
|
+
|
|
46
68
|
<!-- New API structure (with built-in translations) -->
|
|
47
|
-
<ProductEngine
|
|
69
|
+
<ProductEngine engine={{
|
|
48
70
|
code: 'CAYA',
|
|
49
71
|
name: '1.6 TDI',
|
|
50
72
|
serie: { value: 'EA189', label: 'Seria silnika' },
|
|
51
73
|
power: { kw: 55, ps: 75, ps_label: 'KM', label: 'Moc' },
|
|
52
74
|
displacement: { value: 1598, label: 'Pojemność' },
|
|
53
75
|
euro: { value: 5, label: 'Norma Euro' }
|
|
54
|
-
}
|
|
76
|
+
}} />
|
|
55
77
|
|
|
56
78
|
<!-- Old API structure (backward compatible) -->
|
|
57
79
|
<ProductEngine
|
|
58
|
-
|
|
59
|
-
|
|
80
|
+
engine={{ code: 'CAYA', name: '1.6 TDI', kw: 55, ps: 75, cc: 1598, serie: 3, euro: 5 }}
|
|
81
|
+
translations={{ power: 'Moc', cc: 'Pojemność', euro: 'Euro', horsepowerUnit: 'KM' }}
|
|
60
82
|
/>
|
|
61
83
|
```
|
|
62
84
|
|
|
@@ -68,7 +90,7 @@ Engine codes for special editions are automatically color-coded:
|
|
|
68
90
|
<div class="bg-white p-6 w-full flex flex-wrap gap-3">
|
|
69
91
|
<div class="flex flex-col gap-1">
|
|
70
92
|
<small class="text-xs text-gray-500">GTI Engine (Red)</small>
|
|
71
|
-
<ProductEngine
|
|
93
|
+
<ProductEngine engine={{
|
|
72
94
|
code: "CAVE",
|
|
73
95
|
name: "1.4 TSI",
|
|
74
96
|
power: { kw: 132, ps: 180, ps_label: "KM", label: "Moc" },
|
|
@@ -78,7 +100,7 @@ Engine codes for special editions are automatically color-coded:
|
|
|
78
100
|
</div>
|
|
79
101
|
<div class="flex flex-col gap-1">
|
|
80
102
|
<small class="text-xs text-gray-500">WRC Engine (Blue)</small>
|
|
81
|
-
<ProductEngine
|
|
103
|
+
<ProductEngine engine={{
|
|
82
104
|
code: "CDLJ",
|
|
83
105
|
name: "1.6 TDI",
|
|
84
106
|
power: { kw: 165, ps: 220, ps_label: "KM", label: "Moc" },
|
|
@@ -88,7 +110,7 @@ Engine codes for special editions are automatically color-coded:
|
|
|
88
110
|
</div>
|
|
89
111
|
<div class="flex flex-col gap-1">
|
|
90
112
|
<small class="text-xs text-gray-500">Special Blue</small>
|
|
91
|
-
<ProductEngine
|
|
113
|
+
<ProductEngine engine={{
|
|
92
114
|
code: "CPTA",
|
|
93
115
|
name: "1.0 TSI",
|
|
94
116
|
power: { kw: 70, ps: 95, ps_label: "KM", label: "Moc" },
|
|
@@ -99,41 +121,41 @@ Engine codes for special editions are automatically color-coded:
|
|
|
99
121
|
</div>
|
|
100
122
|
</div>
|
|
101
123
|
|
|
102
|
-
```
|
|
124
|
+
```astro
|
|
103
125
|
<!-- GTI Engine - Red -->
|
|
104
|
-
<ProductEngine
|
|
126
|
+
<ProductEngine engine={{
|
|
105
127
|
code: 'CAVE',
|
|
106
128
|
name: '1.4 TSI',
|
|
107
129
|
power: { kw: 132, ps: 180, ps_label: 'KM', label: 'Moc' },
|
|
108
130
|
displacement: { value: 1390, label: 'Pojemność' },
|
|
109
131
|
euro: { value: 5, label: 'Norma Euro' }
|
|
110
|
-
}
|
|
132
|
+
}} />
|
|
111
133
|
|
|
112
134
|
<!-- WRC Engine - Blue -->
|
|
113
|
-
<ProductEngine
|
|
135
|
+
<ProductEngine engine={{
|
|
114
136
|
code: 'CDLJ',
|
|
115
137
|
name: '1.6 TDI',
|
|
116
138
|
power: { kw: 165, ps: 220, ps_label: 'KM', label: 'Moc' },
|
|
117
139
|
displacement: { value: 1598, label: 'Pojemność' },
|
|
118
140
|
euro: { value: 6, label: 'Norma Euro' }
|
|
119
|
-
}
|
|
141
|
+
}} />
|
|
120
142
|
```
|
|
121
143
|
|
|
122
144
|
## Engine List
|
|
123
145
|
|
|
124
146
|
Display multiple engine codes from an array (from API response).
|
|
125
147
|
|
|
126
|
-
###
|
|
148
|
+
### Import:
|
|
127
149
|
|
|
128
150
|
```js
|
|
129
|
-
import ProductEngines from 'spoko-design-system
|
|
151
|
+
import { ProductEngines } from 'spoko-design-system'
|
|
130
152
|
```
|
|
131
153
|
|
|
132
154
|
### Usage:
|
|
133
155
|
|
|
134
156
|
<div class="component-preview">
|
|
135
157
|
<div class="bg-white p-6 w-full">
|
|
136
|
-
<ProductEngines
|
|
158
|
+
<ProductEngines engines={[
|
|
137
159
|
{
|
|
138
160
|
id: 13,
|
|
139
161
|
code: "CAYA",
|
|
@@ -165,8 +187,12 @@ import ProductEngines from 'spoko-design-system/src/components/Product/ProductEn
|
|
|
165
187
|
</div>
|
|
166
188
|
</div>
|
|
167
189
|
|
|
168
|
-
```
|
|
169
|
-
|
|
190
|
+
```astro
|
|
191
|
+
---
|
|
192
|
+
import { ProductEngines } from 'spoko-design-system';
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
<ProductEngines engines={[
|
|
170
196
|
{
|
|
171
197
|
id: 13,
|
|
172
198
|
code: 'CAYA',
|
|
@@ -185,17 +211,17 @@ import ProductEngines from 'spoko-design-system/src/components/Product/ProductEn
|
|
|
185
211
|
displacement: { value: 1598, label: 'Pojemność' },
|
|
186
212
|
euro: { value: 5, label: 'Norma Euro' }
|
|
187
213
|
}
|
|
188
|
-
]
|
|
214
|
+
]} />
|
|
189
215
|
```
|
|
190
216
|
|
|
191
217
|
### With API Data:
|
|
192
218
|
|
|
193
219
|
When using data from the API, pass the `part_engines` array directly. The component automatically extracts translations from the nested structure:
|
|
194
220
|
|
|
195
|
-
```
|
|
221
|
+
```astro
|
|
196
222
|
<ProductEngines
|
|
197
|
-
|
|
198
|
-
|
|
223
|
+
engines={product.part_engines}
|
|
224
|
+
isPdp={true}
|
|
199
225
|
/>
|
|
200
226
|
```
|
|
201
227
|
|
|
@@ -334,7 +360,9 @@ When using data from the API, pass the `part_engines` array directly. The compon
|
|
|
334
360
|
|
|
335
361
|
## Features
|
|
336
362
|
|
|
337
|
-
- ✅ **Rich Tooltips**: Shows detailed engine specifications on hover (Tippy.js)
|
|
363
|
+
- ✅ **Rich Tooltips**: Shows detailed engine specifications on hover (Tippy.js delegation)
|
|
364
|
+
- ✅ **Performance Optimized**: One global script handles all tooltips efficiently
|
|
365
|
+
- ✅ **SEO-Friendly**: Engine codes rendered as static HTML (no hydration)
|
|
338
366
|
- ✅ **API-Driven Translations**: Labels and units come directly from API
|
|
339
367
|
- ✅ **Multi-language**: Supports Polish (KM), German (PS), English (HP)
|
|
340
368
|
- ✅ **Two-Tone Design**: Dark blue header with light body for better hierarchy
|
|
@@ -342,7 +370,6 @@ When using data from the API, pass the `part_engines` array directly. The compon
|
|
|
342
370
|
- ✅ **Clean Layout**: Flexbox-based design with semantic CSS classes
|
|
343
371
|
- ✅ **Smart Data**: Only shows relevant fields (power, displacement, euro)
|
|
344
372
|
- ✅ **Auto-sorting**: Engines automatically sorted alphabetically by code
|
|
345
|
-
- ✅ **SEO-Friendly**: Static HTML enhanced with client-side tooltips
|
|
346
373
|
- ✅ **Backward Compatible**: Works with both new and old API structures
|
|
347
374
|
- ✅ **Touch Friendly**: Works on mobile devices
|
|
348
375
|
|
|
@@ -358,8 +385,10 @@ Special engine codes are automatically color-coded:
|
|
|
358
385
|
|
|
359
386
|
## Notes
|
|
360
387
|
|
|
388
|
+
- **Setup required**: Call `initTooltips()` once in your layout to enable tooltips
|
|
361
389
|
- Hover over any engine code to see full specifications in a detailed tooltip
|
|
362
|
-
- Tooltips use Tippy.js
|
|
390
|
+
- Tooltips use Tippy.js delegation pattern (one global handler for all tooltips)
|
|
391
|
+
- **Performance**: No client-side hydration needed - pure Astro components
|
|
363
392
|
- **New API structure**: Labels come from API (e.g., "Moc", "Pojemność", "KM")
|
|
364
393
|
- **No manual translations needed**: The API provides all labels and units
|
|
365
394
|
- The component automatically extracts series value from nested structure
|
|
@@ -368,3 +397,18 @@ Special engine codes are automatically color-coded:
|
|
|
368
397
|
- Commas between engine codes are automatically handled in lists
|
|
369
398
|
- **Backward compatible**: Still works with old flat API structure
|
|
370
399
|
- Tooltip has dark blue header (#001e50) with light gray body (#f3f4f6)
|
|
400
|
+
|
|
401
|
+
## Migration from Vue to Astro
|
|
402
|
+
|
|
403
|
+
If upgrading from the old Vue version:
|
|
404
|
+
|
|
405
|
+
1. **Remove `client:load`** directive from all ProductEngine/ProductEngines usage
|
|
406
|
+
2. **Add tooltip initialization** to your layout:
|
|
407
|
+
```astro
|
|
408
|
+
<script>
|
|
409
|
+
import { initTooltips } from 'spoko-design-system';
|
|
410
|
+
initTooltips();
|
|
411
|
+
</script>
|
|
412
|
+
```
|
|
413
|
+
3. **Update imports** to use Astro components (automatically handled by package exports)
|
|
414
|
+
4. **No other changes needed** - props and API structure remain the same
|