spoko-design-system 0.2.24 → 0.2.26
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/.github/dependabot.yml +11 -11
- package/.github/todo.yml +3 -3
- package/.github/workflows/deploy.yml +39 -39
- package/.stackblitzrc +5 -5
- package/.vscode/extensions.json +5 -5
- package/.vscode/launch.json +11 -11
- package/.vscode/settings.json +5 -5
- package/LICENSE +21 -21
- package/README.md +113 -113
- package/astro-i18next.config.mjs +17 -17
- package/astro-i18next.config.ts +10 -10
- package/astro.config.mjs +141 -141
- package/dev-dist/sw.js +91 -91
- package/dev-dist/workbox-c676b6d3.js +3391 -3391
- package/index.ts +6 -6
- package/package.json +8 -8
- package/public/fonts/lg.svg +53 -53
- package/public/fonts/vwhead-bold-demo.html +549 -549
- package/public/fonts/vwhead-regular-demo.html +549 -549
- package/public/fonts/vwtext-bold-demo.html +549 -549
- package/public/fonts/vwtext-regular-demo.html +549 -549
- package/public/github.svg +3 -3
- package/public/grid_dot.svg +4 -4
- package/public/linkedin.svg +44 -44
- package/public/locales/en/translation.json +8 -8
- package/public/locales/pl/translation.json +8 -8
- package/public/make-scrollable-code-focusable.js +3 -3
- package/public/pagefind.yml +3 -3
- package/public/polo.blue.svg +29 -29
- package/public/spoko.space.svg +71 -71
- package/public/twitter.svg +46 -46
- package/renovate.json +6 -6
- package/sandbox.config.json +11 -11
- package/src/MyComponent.astro +8 -8
- package/src/components/Badge.vue +19 -19
- package/src/components/Badges.vue +21 -21
- package/src/components/Breadcrumbs.vue +110 -110
- package/src/components/Button.vue +55 -55
- package/src/components/ButtonCopy.vue +47 -47
- package/src/components/Card.astro +27 -27
- package/src/components/Carousel.astro +26 -26
- package/src/components/CategoryLink.astro +18 -18
- package/src/components/Copyright.astro +12 -12
- package/src/components/Date.astro +7 -7
- package/src/components/FeaturesList.vue +41 -41
- package/src/components/FuckRussia.vue +80 -80
- package/src/components/HandDrive.astro +29 -29
- package/src/components/Header/Header.astro +214 -214
- package/src/components/Header/SkipToContent.astro +1 -1
- package/src/components/Headline.vue +48 -48
- package/src/components/Image.astro +30 -30
- package/src/components/Jumbatron.vue +40 -40
- package/src/components/LeftSidebar.astro +53 -53
- package/src/components/MainColors.vue +23 -23
- package/src/components/MainInput.vue +15 -15
- package/src/components/Modal.astro +27 -27
- package/src/components/PageContent.astro +5 -5
- package/src/components/PartNumber.vue +27 -27
- package/src/components/PostHeader.astro +103 -103
- package/src/components/PrCode.vue +156 -156
- package/src/components/ProductCarousel.astro +38 -38
- package/src/components/ProductCodes.vue +39 -39
- package/src/components/ProductDetailName.vue +52 -52
- package/src/components/ProductDetailsList.vue +65 -65
- package/src/components/ProductNumber copy.astro +116 -116
- package/src/components/ProductNumber.astro +114 -114
- package/src/components/ProductTile.astro +48 -48
- package/src/components/Quote.vue +23 -23
- package/src/components/ReloadPrompt.astro +50 -50
- package/src/components/SlimBanner.vue +73 -82
- package/src/components/Table.vue +32 -32
- package/src/components/TableOfContents.astro +15 -15
- package/src/components/Translations.vue +23 -23
- package/src/components/flags/FlagPL.vue +3 -3
- package/src/components/flags/FlagUA.vue +2 -2
- package/src/components/layout/Container.astro +7 -7
- package/src/components/layout/Header.astro +80 -80
- package/src/config.ts +56 -56
- package/src/design.config.ts +79 -79
- package/src/env.d.ts +1 -1
- package/src/layouts/Layout.astro +60 -60
- package/src/layouts/MainLayout.astro +81 -81
- package/src/layouts/partials/FooterCommon.astro +4 -4
- package/src/layouts/partials/HeadCommon.astro +44 -44
- package/src/layouts/partials/HeadSEO.astro +41 -41
- package/src/pages/components/badges.mdx +57 -55
- package/src/pages/components/breadcrumbs.mdx +139 -139
- package/src/pages/components/buttons.mdx +236 -236
- package/src/pages/components/card.mdx +294 -294
- package/src/pages/components/carousel.mdx +62 -62
- package/src/pages/components/copyright.mdx +42 -42
- package/src/pages/components/details-list.mdx +115 -115
- package/src/pages/components/features-list.mdx +37 -37
- package/src/pages/components/flags.mdx +49 -49
- package/src/pages/components/fuck-russia.mdx +39 -39
- package/src/pages/components/hand-drive.mdx +38 -38
- package/src/pages/components/headline.mdx +152 -152
- package/src/pages/components/icons.astro +48 -48
- package/src/pages/components/image.mdx +513 -513
- package/src/pages/components/input.mdx +45 -45
- package/src/pages/components/jumbatron.mdx +73 -73
- package/src/pages/components/modal.mdx +64 -64
- package/src/pages/components/post-header.mdx +60 -60
- package/src/pages/components/pr-code.mdx +65 -65
- package/src/pages/components/product-number.mdx +66 -66
- package/src/pages/components/product-tile.mdx +51 -51
- package/src/pages/components/quote.mdx +33 -33
- package/src/pages/components/slimbanner.mdx +29 -29
- package/src/pages/components/table.mdx +108 -108
- package/src/pages/core/colors.mdx +10 -10
- package/src/pages/core/grid.mdx +89 -89
- package/src/pages/core/introduction.mdx +77 -77
- package/src/pages/core/shadows.astro +20 -20
- package/src/pages/core/typography.astro +47 -47
- package/src/pages/index.astro +125 -125
- package/src/pages/patterns/introduction.mdx +60 -60
- package/src/pwa.ts +12 -12
- package/src/styles/_variables.scss +66 -66
- package/src/styles/base/_base.scss +184 -184
- package/src/styles/base/_typography.scss +70 -70
- package/src/styles/base/grid.scss +98 -98
- package/src/styles/content.scss +64 -64
- package/src/styles/main.scss +7 -7
- package/tailwind.config.cjs +8 -8
- package/tsconfig.json +11 -11
- package/uno.config.ts +254 -252
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { PropType } from "vue";
|
|
3
|
-
import ProductDetailName from "./ProductDetailName.vue";
|
|
4
|
-
|
|
5
|
-
interface TableItem {
|
|
6
|
-
id: string,
|
|
7
|
-
name: string
|
|
8
|
-
value: unknown
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const props = defineProps({
|
|
12
|
-
items: {type: Array as PropType<TableItem[]>, default: () => []},
|
|
13
|
-
caption: { type: String, default: null }
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
</script>
|
|
17
|
-
|
|
18
|
-
<template>
|
|
19
|
-
<table class="details table-auto text-left bg-white">
|
|
20
|
-
<caption v-if="!!$slots.caption || caption">
|
|
21
|
-
<slot name="caption">{{ caption }}</slot>
|
|
22
|
-
</caption>
|
|
23
|
-
<colgroup>
|
|
24
|
-
<col>
|
|
25
|
-
<col>
|
|
26
|
-
</colgroup>
|
|
27
|
-
<tbody>
|
|
28
|
-
<tr v-for="row, index in props.items" :key="index">
|
|
29
|
-
<ProductDetailName as="th" :text="row.name" />
|
|
30
|
-
<slot :name="row.id">
|
|
31
|
-
<td>{{ row.value }}</td>
|
|
32
|
-
</slot>
|
|
33
|
-
</tr>
|
|
34
|
-
</tbody>
|
|
35
|
-
</table>
|
|
36
|
-
</template>
|
|
37
|
-
|
|
38
|
-
<style lang="scss" scoped>
|
|
39
|
-
.details {
|
|
40
|
-
@apply border-none shadow-none w-full md:w-auto
|
|
41
|
-
box-shadow: none;
|
|
42
|
-
|
|
43
|
-
col {
|
|
44
|
-
@apply w-1/2 md:w-auto;
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
tr {
|
|
49
|
-
@apply border-none;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
tr,
|
|
53
|
-
th {
|
|
54
|
-
@apply leading-none text-3.5 py-2 border-none xl:(py-4) 3xl:(text-4);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
th {
|
|
58
|
-
@apply px-0;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
td {
|
|
62
|
-
@apply relative;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
</style>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { PropType } from "vue";
|
|
3
|
+
import ProductDetailName from "./ProductDetailName.vue";
|
|
4
|
+
|
|
5
|
+
interface TableItem {
|
|
6
|
+
id: string,
|
|
7
|
+
name: string
|
|
8
|
+
value: unknown
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const props = defineProps({
|
|
12
|
+
items: {type: Array as PropType<TableItem[]>, default: () => []},
|
|
13
|
+
caption: { type: String, default: null }
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<table class="details table-auto text-left bg-white">
|
|
20
|
+
<caption v-if="!!$slots.caption || caption">
|
|
21
|
+
<slot name="caption">{{ caption }}</slot>
|
|
22
|
+
</caption>
|
|
23
|
+
<colgroup>
|
|
24
|
+
<col>
|
|
25
|
+
<col>
|
|
26
|
+
</colgroup>
|
|
27
|
+
<tbody>
|
|
28
|
+
<tr v-for="row, index in props.items" :key="index">
|
|
29
|
+
<ProductDetailName as="th" :text="row.name" />
|
|
30
|
+
<slot :name="row.id">
|
|
31
|
+
<td>{{ row.value }}</td>
|
|
32
|
+
</slot>
|
|
33
|
+
</tr>
|
|
34
|
+
</tbody>
|
|
35
|
+
</table>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<style lang="scss" scoped>
|
|
39
|
+
.details {
|
|
40
|
+
@apply border-none shadow-none w-full md:w-auto
|
|
41
|
+
box-shadow: none;
|
|
42
|
+
|
|
43
|
+
col {
|
|
44
|
+
@apply w-1/2 md:w-auto;
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
tr {
|
|
49
|
+
@apply border-none;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
tr,
|
|
53
|
+
th {
|
|
54
|
+
@apply leading-none text-3.5 py-2 border-none xl:(py-4) 3xl:(text-4);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
th {
|
|
58
|
+
@apply px-0;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
td {
|
|
62
|
+
@apply relative;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
</style>
|
|
@@ -1,116 +1,116 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { t } from "i18next";
|
|
3
|
-
import ButtonCopy from "./ButtonCopy.vue";
|
|
4
|
-
|
|
5
|
-
const {
|
|
6
|
-
copyDisabled,
|
|
7
|
-
productNumber,
|
|
8
|
-
isPdp,
|
|
9
|
-
small,
|
|
10
|
-
big,
|
|
11
|
-
class: className,
|
|
12
|
-
} = Astro.props;
|
|
13
|
-
|
|
14
|
-
const butonTexts = {
|
|
15
|
-
copy: t("copy"),
|
|
16
|
-
copied: t("copied"),
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const isLetter = (string: string) => {
|
|
20
|
-
return string.toLowerCase() !== string.toUpperCase();
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const niceName = (string: string, separator = "\u00A0") => {
|
|
24
|
-
let word = string; //e.g. to 6Q0947106EY20 .split('+')
|
|
25
|
-
|
|
26
|
-
if (
|
|
27
|
-
isLetter(string[0]) === true &&
|
|
28
|
-
isLetter(string[1]) === false &&
|
|
29
|
-
string.length === 9
|
|
30
|
-
) {
|
|
31
|
-
// mainly liquids
|
|
32
|
-
word = string
|
|
33
|
-
.replace(
|
|
34
|
-
/^(\w{1})(\w{3})(\w{3})(.*)$/,
|
|
35
|
-
`$1${separator}$2${separator}$3${separator}$4`,
|
|
36
|
-
)
|
|
37
|
-
.replace(/(^\s+|\s+$)/, "");
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// wheels / emblems e.g. 6R0601025AK8Z8 --> 6R0 601 025 AB 8Z8 || 6C0601025DFZZ --> 6C0 601 025 D FZZ || 6R0853433ADA1 -> 6R0 853 433 A DA1
|
|
41
|
-
else if (string.length >= 13) {
|
|
42
|
-
// console.log('part number: wheels / emblems', word)
|
|
43
|
-
word = string
|
|
44
|
-
.replace(
|
|
45
|
-
/^(\w{3})(\w{3})(\w{3})(.*)(\w{3})$/,
|
|
46
|
-
`$1${separator}$2${separator}$3${separator}$4${separator}$5`,
|
|
47
|
-
)
|
|
48
|
-
.replace(/(^\s+|\s+$)/, "");
|
|
49
|
-
} else if (string.length > 12) {
|
|
50
|
-
// accessories / mats
|
|
51
|
-
word = string
|
|
52
|
-
.replace(
|
|
53
|
-
/^(\w{3})(\w{3})(\w{3})(\w{1})(.*)$/,
|
|
54
|
-
`$1${separator}$2${separator}$3${separator}$4${separator}$5`,
|
|
55
|
-
)
|
|
56
|
-
.replace(/(^\s+|\s+$)/, "");
|
|
57
|
-
} else {
|
|
58
|
-
// other parts
|
|
59
|
-
word = string
|
|
60
|
-
.replace(/(\w{3})/g, `$1${separator}`)
|
|
61
|
-
.replace(/(^\s+|\s+$)/, "");
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return word.replace(" ", separator);
|
|
65
|
-
};
|
|
66
|
-
---
|
|
67
|
-
|
|
68
|
-
{
|
|
69
|
-
productNumber !== null && (
|
|
70
|
-
<div
|
|
71
|
-
class={`product-number ${
|
|
72
|
-
big ? "text-lg" : `text-sm ${className ? className : "mt-2 sm:mt-0"}`
|
|
73
|
-
}`}
|
|
74
|
-
>
|
|
75
|
-
<div
|
|
76
|
-
class={`inline-flex leading-none relative ${small ? "w-full" : ""}`}
|
|
77
|
-
itemprop="identifier"
|
|
78
|
-
>
|
|
79
|
-
{isPdp ? (
|
|
80
|
-
<h2 id={productNumber} class="product-code">
|
|
81
|
-
{productNumber}
|
|
82
|
-
</h2>
|
|
83
|
-
) : (
|
|
84
|
-
<div id={productNumber} class="product-code">
|
|
85
|
-
{productNumber}
|
|
86
|
-
</div>
|
|
87
|
-
)}
|
|
88
|
-
|
|
89
|
-
{copyDisabled && (
|
|
90
|
-
<ButtonCopy
|
|
91
|
-
productNumber={String(productNumber)}
|
|
92
|
-
texts={butonTexts}
|
|
93
|
-
tooltipClasses=""
|
|
94
|
-
client:only
|
|
95
|
-
/>
|
|
96
|
-
)}
|
|
97
|
-
</div>
|
|
98
|
-
|
|
99
|
-
<div
|
|
100
|
-
class={`code-formatted ${small ? "tracking-wide" : "tracking-tight"}`}
|
|
101
|
-
>
|
|
102
|
-
<div class="relative inset-0" data-pagefind-ignore>
|
|
103
|
-
{niceName(productNumber, ".")}
|
|
104
|
-
</div>
|
|
105
|
-
<div class="absolute inset-0" data-pagefind-ignore>
|
|
106
|
-
{niceName(productNumber, "-")}
|
|
107
|
-
</div>
|
|
108
|
-
{isPdp ? (
|
|
109
|
-
<h3 class="number-secondary">{niceName(productNumber)}</h3>
|
|
110
|
-
) : (
|
|
111
|
-
<div class="number-secondary">{niceName(productNumber)}</div>
|
|
112
|
-
)}
|
|
113
|
-
</div>
|
|
114
|
-
</div>
|
|
115
|
-
)
|
|
116
|
-
}
|
|
1
|
+
---
|
|
2
|
+
import { t } from "i18next";
|
|
3
|
+
import ButtonCopy from "./ButtonCopy.vue";
|
|
4
|
+
|
|
5
|
+
const {
|
|
6
|
+
copyDisabled,
|
|
7
|
+
productNumber,
|
|
8
|
+
isPdp,
|
|
9
|
+
small,
|
|
10
|
+
big,
|
|
11
|
+
class: className,
|
|
12
|
+
} = Astro.props;
|
|
13
|
+
|
|
14
|
+
const butonTexts = {
|
|
15
|
+
copy: t("copy"),
|
|
16
|
+
copied: t("copied"),
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const isLetter = (string: string) => {
|
|
20
|
+
return string.toLowerCase() !== string.toUpperCase();
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const niceName = (string: string, separator = "\u00A0") => {
|
|
24
|
+
let word = string; //e.g. to 6Q0947106EY20 .split('+')
|
|
25
|
+
|
|
26
|
+
if (
|
|
27
|
+
isLetter(string[0]) === true &&
|
|
28
|
+
isLetter(string[1]) === false &&
|
|
29
|
+
string.length === 9
|
|
30
|
+
) {
|
|
31
|
+
// mainly liquids
|
|
32
|
+
word = string
|
|
33
|
+
.replace(
|
|
34
|
+
/^(\w{1})(\w{3})(\w{3})(.*)$/,
|
|
35
|
+
`$1${separator}$2${separator}$3${separator}$4`,
|
|
36
|
+
)
|
|
37
|
+
.replace(/(^\s+|\s+$)/, "");
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// wheels / emblems e.g. 6R0601025AK8Z8 --> 6R0 601 025 AB 8Z8 || 6C0601025DFZZ --> 6C0 601 025 D FZZ || 6R0853433ADA1 -> 6R0 853 433 A DA1
|
|
41
|
+
else if (string.length >= 13) {
|
|
42
|
+
// console.log('part number: wheels / emblems', word)
|
|
43
|
+
word = string
|
|
44
|
+
.replace(
|
|
45
|
+
/^(\w{3})(\w{3})(\w{3})(.*)(\w{3})$/,
|
|
46
|
+
`$1${separator}$2${separator}$3${separator}$4${separator}$5`,
|
|
47
|
+
)
|
|
48
|
+
.replace(/(^\s+|\s+$)/, "");
|
|
49
|
+
} else if (string.length > 12) {
|
|
50
|
+
// accessories / mats
|
|
51
|
+
word = string
|
|
52
|
+
.replace(
|
|
53
|
+
/^(\w{3})(\w{3})(\w{3})(\w{1})(.*)$/,
|
|
54
|
+
`$1${separator}$2${separator}$3${separator}$4${separator}$5`,
|
|
55
|
+
)
|
|
56
|
+
.replace(/(^\s+|\s+$)/, "");
|
|
57
|
+
} else {
|
|
58
|
+
// other parts
|
|
59
|
+
word = string
|
|
60
|
+
.replace(/(\w{3})/g, `$1${separator}`)
|
|
61
|
+
.replace(/(^\s+|\s+$)/, "");
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return word.replace(" ", separator);
|
|
65
|
+
};
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
{
|
|
69
|
+
productNumber !== null && (
|
|
70
|
+
<div
|
|
71
|
+
class={`product-number ${
|
|
72
|
+
big ? "text-lg" : `text-sm ${className ? className : "mt-2 sm:mt-0"}`
|
|
73
|
+
}`}
|
|
74
|
+
>
|
|
75
|
+
<div
|
|
76
|
+
class={`inline-flex leading-none relative ${small ? "w-full" : ""}`}
|
|
77
|
+
itemprop="identifier"
|
|
78
|
+
>
|
|
79
|
+
{isPdp ? (
|
|
80
|
+
<h2 id={productNumber} class="product-code">
|
|
81
|
+
{productNumber}
|
|
82
|
+
</h2>
|
|
83
|
+
) : (
|
|
84
|
+
<div id={productNumber} class="product-code">
|
|
85
|
+
{productNumber}
|
|
86
|
+
</div>
|
|
87
|
+
)}
|
|
88
|
+
|
|
89
|
+
{copyDisabled && (
|
|
90
|
+
<ButtonCopy
|
|
91
|
+
productNumber={String(productNumber)}
|
|
92
|
+
texts={butonTexts}
|
|
93
|
+
tooltipClasses=""
|
|
94
|
+
client:only
|
|
95
|
+
/>
|
|
96
|
+
)}
|
|
97
|
+
</div>
|
|
98
|
+
|
|
99
|
+
<div
|
|
100
|
+
class={`code-formatted ${small ? "tracking-wide" : "tracking-tight"}`}
|
|
101
|
+
>
|
|
102
|
+
<div class="relative inset-0" data-pagefind-ignore>
|
|
103
|
+
{niceName(productNumber, ".")}
|
|
104
|
+
</div>
|
|
105
|
+
<div class="absolute inset-0" data-pagefind-ignore>
|
|
106
|
+
{niceName(productNumber, "-")}
|
|
107
|
+
</div>
|
|
108
|
+
{isPdp ? (
|
|
109
|
+
<h3 class="number-secondary">{niceName(productNumber)}</h3>
|
|
110
|
+
) : (
|
|
111
|
+
<div class="number-secondary">{niceName(productNumber)}</div>
|
|
112
|
+
)}
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
)
|
|
116
|
+
}
|
|
@@ -1,114 +1,114 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { t } from "i18next";
|
|
3
|
-
import ButtonCopy from "./ButtonCopy.vue";
|
|
4
|
-
import PartNumber from "./PartNumber.vue";
|
|
5
|
-
|
|
6
|
-
const {
|
|
7
|
-
copyDisabled,
|
|
8
|
-
productNumber,
|
|
9
|
-
as,
|
|
10
|
-
isPdp,
|
|
11
|
-
small,
|
|
12
|
-
big,
|
|
13
|
-
class: className,
|
|
14
|
-
} = Astro.props;
|
|
15
|
-
|
|
16
|
-
const butonTexts = {
|
|
17
|
-
copy: t("copy"),
|
|
18
|
-
copied: t("copied"),
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const isLetter = (string: string) => {
|
|
22
|
-
return string.toLowerCase() !== string.toUpperCase();
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const niceName = (string: string, separator = "\u00A0") => {
|
|
26
|
-
let word = string; //e.g. to 6Q0947106EY20 .split('+')
|
|
27
|
-
|
|
28
|
-
if (
|
|
29
|
-
isLetter(string[0]) === true &&
|
|
30
|
-
isLetter(string[1]) === false &&
|
|
31
|
-
string.length === 9
|
|
32
|
-
) {
|
|
33
|
-
// mainly liquids
|
|
34
|
-
word = string
|
|
35
|
-
.replace(
|
|
36
|
-
/^(\w{1})(\w{3})(\w{3})(.*)$/,
|
|
37
|
-
`$1${separator}$2${separator}$3${separator}$4`,
|
|
38
|
-
)
|
|
39
|
-
.replace(/(^\s+|\s+$)/, "");
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// wheels / emblems e.g. 6R0601025AK8Z8 --> 6R0 601 025 AB 8Z8 || 6C0601025DFZZ --> 6C0 601 025 D FZZ || 6R0853433ADA1 -> 6R0 853 433 A DA1
|
|
43
|
-
else if (string.length >= 13) {
|
|
44
|
-
// console.log('part number: wheels / emblems', word)
|
|
45
|
-
word = string
|
|
46
|
-
.replace(
|
|
47
|
-
/^(\w{3})(\w{3})(\w{3})(.*)(\w{3})$/,
|
|
48
|
-
`$1${separator}$2${separator}$3${separator}$4${separator}$5`,
|
|
49
|
-
)
|
|
50
|
-
.replace(/(^\s+|\s+$)/, "");
|
|
51
|
-
} else if (string.length > 12) {
|
|
52
|
-
// accessories / mats
|
|
53
|
-
word = string
|
|
54
|
-
.replace(
|
|
55
|
-
/^(\w{3})(\w{3})(\w{3})(\w{1})(.*)$/,
|
|
56
|
-
`$1${separator}$2${separator}$3${separator}$4${separator}$5`,
|
|
57
|
-
)
|
|
58
|
-
.replace(/(^\s+|\s+$)/, "");
|
|
59
|
-
} else {
|
|
60
|
-
// other parts
|
|
61
|
-
word = string
|
|
62
|
-
.replace(/(\w{3})/g, `$1${separator}`)
|
|
63
|
-
.replace(/(^\s+|\s+$)/, "");
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// remove single separator from the end of string:
|
|
67
|
-
let lastCharacter = word.split('').pop() || '';
|
|
68
|
-
|
|
69
|
-
if (!Boolean(lastCharacter.match(/[a-zA-Z0-9]/))) {
|
|
70
|
-
word = word.slice(0, -1)
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return word.replace(" ", separator);
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const classes = `product-number ${big ? "text-5.5 leading-none" : "text-sm"} ${className}` //mt-2 sm:mt-0
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
---
|
|
80
|
-
|
|
81
|
-
<!-- <PartNumber number={productNumber} as="div"></PartNumber> -->
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
{
|
|
85
|
-
productNumber !== null && (
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
<PartNumber class={`${classes} product-code`} number={productNumber} as={isPdp ? 'h2' : 'div'} />
|
|
89
|
-
|
|
90
|
-
<div
|
|
91
|
-
class={`code-formatted ${small ? "tracking-wide" : "tracking-tight"}`}
|
|
92
|
-
>
|
|
93
|
-
<div class="relative inset-0" data-pagefind-ignore>
|
|
94
|
-
{niceName(productNumber, ".")}
|
|
95
|
-
</div>
|
|
96
|
-
<div class="absolute inset-0" data-pagefind-ignore>
|
|
97
|
-
{niceName(productNumber, "-")}
|
|
98
|
-
</div>
|
|
99
|
-
<PartNumber class="number-secondary" number={niceName(productNumber)} as={isPdp ? 'h3' : 'div'} />
|
|
100
|
-
</div>
|
|
101
|
-
|
|
102
|
-
)
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
<!-- {!copyDisabled && ( -->
|
|
107
|
-
<ButtonCopy
|
|
108
|
-
class="top-1 right-0"
|
|
109
|
-
productNumber={String(productNumber)}
|
|
110
|
-
texts={butonTexts}
|
|
111
|
-
tooltipClasses=""
|
|
112
|
-
client:only
|
|
113
|
-
/>
|
|
114
|
-
<!-- )} -->
|
|
1
|
+
---
|
|
2
|
+
import { t } from "i18next";
|
|
3
|
+
import ButtonCopy from "./ButtonCopy.vue";
|
|
4
|
+
import PartNumber from "./PartNumber.vue";
|
|
5
|
+
|
|
6
|
+
const {
|
|
7
|
+
copyDisabled,
|
|
8
|
+
productNumber,
|
|
9
|
+
as,
|
|
10
|
+
isPdp,
|
|
11
|
+
small,
|
|
12
|
+
big,
|
|
13
|
+
class: className,
|
|
14
|
+
} = Astro.props;
|
|
15
|
+
|
|
16
|
+
const butonTexts = {
|
|
17
|
+
copy: t("copy"),
|
|
18
|
+
copied: t("copied"),
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const isLetter = (string: string) => {
|
|
22
|
+
return string.toLowerCase() !== string.toUpperCase();
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const niceName = (string: string, separator = "\u00A0") => {
|
|
26
|
+
let word = string; //e.g. to 6Q0947106EY20 .split('+')
|
|
27
|
+
|
|
28
|
+
if (
|
|
29
|
+
isLetter(string[0]) === true &&
|
|
30
|
+
isLetter(string[1]) === false &&
|
|
31
|
+
string.length === 9
|
|
32
|
+
) {
|
|
33
|
+
// mainly liquids
|
|
34
|
+
word = string
|
|
35
|
+
.replace(
|
|
36
|
+
/^(\w{1})(\w{3})(\w{3})(.*)$/,
|
|
37
|
+
`$1${separator}$2${separator}$3${separator}$4`,
|
|
38
|
+
)
|
|
39
|
+
.replace(/(^\s+|\s+$)/, "");
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// wheels / emblems e.g. 6R0601025AK8Z8 --> 6R0 601 025 AB 8Z8 || 6C0601025DFZZ --> 6C0 601 025 D FZZ || 6R0853433ADA1 -> 6R0 853 433 A DA1
|
|
43
|
+
else if (string.length >= 13) {
|
|
44
|
+
// console.log('part number: wheels / emblems', word)
|
|
45
|
+
word = string
|
|
46
|
+
.replace(
|
|
47
|
+
/^(\w{3})(\w{3})(\w{3})(.*)(\w{3})$/,
|
|
48
|
+
`$1${separator}$2${separator}$3${separator}$4${separator}$5`,
|
|
49
|
+
)
|
|
50
|
+
.replace(/(^\s+|\s+$)/, "");
|
|
51
|
+
} else if (string.length > 12) {
|
|
52
|
+
// accessories / mats
|
|
53
|
+
word = string
|
|
54
|
+
.replace(
|
|
55
|
+
/^(\w{3})(\w{3})(\w{3})(\w{1})(.*)$/,
|
|
56
|
+
`$1${separator}$2${separator}$3${separator}$4${separator}$5`,
|
|
57
|
+
)
|
|
58
|
+
.replace(/(^\s+|\s+$)/, "");
|
|
59
|
+
} else {
|
|
60
|
+
// other parts
|
|
61
|
+
word = string
|
|
62
|
+
.replace(/(\w{3})/g, `$1${separator}`)
|
|
63
|
+
.replace(/(^\s+|\s+$)/, "");
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// remove single separator from the end of string:
|
|
67
|
+
let lastCharacter = word.split('').pop() || '';
|
|
68
|
+
|
|
69
|
+
if (!Boolean(lastCharacter.match(/[a-zA-Z0-9]/))) {
|
|
70
|
+
word = word.slice(0, -1)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return word.replace(" ", separator);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const classes = `product-number ${big ? "text-5.5 leading-none" : "text-sm"} ${className}` //mt-2 sm:mt-0
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
<!-- <PartNumber number={productNumber} as="div"></PartNumber> -->
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
{
|
|
85
|
+
productNumber !== null && (
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
<PartNumber class={`${classes} product-code`} number={productNumber} as={isPdp ? 'h2' : 'div'} />
|
|
89
|
+
|
|
90
|
+
<div
|
|
91
|
+
class={`code-formatted ${small ? "tracking-wide" : "tracking-tight"}`}
|
|
92
|
+
>
|
|
93
|
+
<div class="relative inset-0" data-pagefind-ignore>
|
|
94
|
+
{niceName(productNumber, ".")}
|
|
95
|
+
</div>
|
|
96
|
+
<div class="absolute inset-0" data-pagefind-ignore>
|
|
97
|
+
{niceName(productNumber, "-")}
|
|
98
|
+
</div>
|
|
99
|
+
<PartNumber class="number-secondary" number={niceName(productNumber)} as={isPdp ? 'h3' : 'div'} />
|
|
100
|
+
</div>
|
|
101
|
+
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
<!-- {!copyDisabled && ( -->
|
|
107
|
+
<ButtonCopy
|
|
108
|
+
class="top-1 right-0"
|
|
109
|
+
productNumber={String(productNumber)}
|
|
110
|
+
texts={butonTexts}
|
|
111
|
+
tooltipClasses=""
|
|
112
|
+
client:only
|
|
113
|
+
/>
|
|
114
|
+
<!-- )} -->
|