spoko-design-system 0.7.3 → 0.7.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spoko-design-system",
3
- "version": "0.7.3",
3
+ "version": "0.7.4",
4
4
  "private": false,
5
5
  "main": "./index.ts",
6
6
  "module": "./index.ts",
@@ -3,16 +3,31 @@ import { PropType } from "vue";
3
3
  import ProductDetailName from "./ProductDetailName.vue";
4
4
 
5
5
  interface TableItem {
6
- id: string,
7
- name: string
8
- value: unknown
6
+ id: string;
7
+ name: string;
8
+ value: unknown;
9
+ translated?: boolean;
10
+ icon?: boolean;
9
11
  }
10
12
 
11
13
  const props = defineProps({
12
- items: {type: Array as PropType<TableItem[]>, default: () => []},
14
+ items: { type: Array as PropType<TableItem[]>, default: () => [] },
13
15
  caption: { type: String, default: null }
14
- })
16
+ });
15
17
 
18
+ const isLink = (id: string) => {
19
+ return ['blog', 'youtube', 'vimeo'].includes(id);
20
+ };
21
+
22
+
23
+ const getHeaderText = (row: TableItem) => {
24
+ if (row.id === 'blog') {
25
+ return row.id.charAt(0).toUpperCase() + row.id.slice(1);
26
+ }
27
+
28
+
29
+ return row.name;
30
+ };
16
31
  </script>
17
32
 
18
33
  <template>
@@ -26,8 +41,15 @@ const props = defineProps({
26
41
  </colgroup>
27
42
  <tbody>
28
43
  <tr v-for="row, index in props.items" :key="index">
29
- <ProductDetailName as="th" :text="row.name" />
30
- <slot :name="row.id">
44
+ <ProductDetailName as="th" :text="getHeaderText(row)" />
45
+
46
+ <td v-if="isLink(row.id)" class="link-cell">
47
+ <a :href="row.value as string" target="_blank" rel="noopener noreferrer" class="link-primary">
48
+ {{ row.name }} <!-- row.name zawiera tekst anchora dla linków -->
49
+ </a>
50
+ </td>
51
+
52
+ <slot v-else :name="row.id">
31
53
  <td>{{ row.value }}</td>
32
54
  </slot>
33
55
  </tr>
@@ -36,30 +58,33 @@ const props = defineProps({
36
58
  </template>
37
59
 
38
60
  <style 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;
61
+ .details {
62
+ @apply border-none shadow-none w-full md:w-auto;
63
+ box-shadow: none;
45
64
 
46
- }
65
+ col {
66
+ @apply w-1/2 md:w-auto;
67
+ }
47
68
 
48
- tr {
49
- @apply border-none;
50
- }
69
+ tr {
70
+ @apply border-none;
71
+ }
51
72
 
52
- tr,
53
- th {
54
- @apply leading-none text-3.5 py-2 border-none xl:(py-4) 3xl:(text-4);
55
- }
73
+ tr,
74
+ th {
75
+ @apply leading-none text-3.5 py-2 border-none xl:(py-4) 3xl:(text-4);
76
+ }
56
77
 
57
- th {
58
- @apply px-0;
59
- }
78
+ th {
79
+ @apply px-0;
80
+ }
60
81
 
61
- td {
62
- @apply relative;
63
- }
82
+ td {
83
+ @apply relative;
64
84
  }
65
- </style>
85
+ }
86
+
87
+ .link-primary {
88
+ @apply text-blue-600 hover:text-blue-800 hover:underline;
89
+ }
90
+ </style>