@erst-vg/vg-design-wrapper 2.0.1 → 2.1.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.
Files changed (193) hide show
  1. package/CHANGELOG.md +49 -41
  2. package/README.md +2 -2
  3. package/dist/src/components/VgVideo.vue.d.ts +0 -8
  4. package/dist/vg-design-wrapper.js +518 -563
  5. package/dist/vg-design-wrapper.umd.cjs +24 -24
  6. package/package.json +91 -89
  7. package/src/assets/icons/abonnementFilled.svg +4 -4
  8. package/src/assets/icons/abonnementOutline.svg +4 -4
  9. package/src/assets/icons/accordion.svg +2 -2
  10. package/src/assets/icons/accordionClose.svg +2 -2
  11. package/src/assets/icons/accordionCloseOld.svg +6 -6
  12. package/src/assets/icons/accordionOpen.svg +3 -3
  13. package/src/assets/icons/accordionOpenOld.svg +6 -6
  14. package/src/assets/icons/accountCircle.svg +2 -2
  15. package/src/assets/icons/add.svg +5 -5
  16. package/src/assets/icons/addBig.svg +5 -5
  17. package/src/assets/icons/afpublicer.svg +2 -2
  18. package/src/assets/icons/agenda.svg +3 -3
  19. package/src/assets/icons/anchorlink.svg +3 -3
  20. package/src/assets/icons/anchormenuer.svg +3 -3
  21. package/src/assets/icons/anden.svg +3 -3
  22. package/src/assets/icons/angleArrowDown.svg +2 -2
  23. package/src/assets/icons/angleArrowUp.svg +2 -2
  24. package/src/assets/icons/ansoegninger.svg +6 -6
  25. package/src/assets/icons/antal-gange.svg +6 -6
  26. package/src/assets/icons/applikationer.svg +2 -2
  27. package/src/assets/icons/arrowLeft.svg +2 -2
  28. package/src/assets/icons/arrowRight.svg +2 -2
  29. package/src/assets/icons/bell.svg +2 -2
  30. package/src/assets/icons/bellAlarmFilled.svg +2 -2
  31. package/src/assets/icons/bellAlarmOutline.svg +2 -2
  32. package/src/assets/icons/bellOvercrossed.svg +2 -2
  33. package/src/assets/icons/beskedcenter.svg +2 -2
  34. package/src/assets/icons/billede.svg +2 -2
  35. package/src/assets/icons/bogmaerker.svg +2 -2
  36. package/src/assets/icons/bookmarkFilled.svg +2 -2
  37. package/src/assets/icons/bookmarkOutline.svg +2 -2
  38. package/src/assets/icons/breadcrumbArrow.svg +3 -3
  39. package/src/assets/icons/bred_smal.svg +3 -3
  40. package/src/assets/icons/cSRDAddDatapunkt.svg +5 -5
  41. package/src/assets/icons/cSRDAddMultipleDatapunkter.svg +7 -7
  42. package/src/assets/icons/cSRDLockedDatapunkt.svg +4 -4
  43. package/src/assets/icons/cSRDRemoveDatapunkt.svg +5 -5
  44. package/src/assets/icons/cSRDRemoveDatapunktOversigt.svg +4 -4
  45. package/src/assets/icons/calendar.svg +2 -2
  46. package/src/assets/icons/calendarOutline.svg +2 -2
  47. package/src/assets/icons/callToAction.svg +2 -2
  48. package/src/assets/icons/card.svg +2 -2
  49. package/src/assets/icons/carouselArrowLeft.svg +2 -2
  50. package/src/assets/icons/carouselArrowRight.svg +2 -2
  51. package/src/assets/icons/category.svg +2 -2
  52. package/src/assets/icons/center.svg +3 -3
  53. package/src/assets/icons/check.svg +2 -2
  54. package/src/assets/icons/chevronLeft.svg +2 -2
  55. package/src/assets/icons/circularArrow.svg +3 -3
  56. package/src/assets/icons/close.svg +2 -2
  57. package/src/assets/icons/closeCircleOutline.svg +2 -2
  58. package/src/assets/icons/closeCirleFilled.svg +2 -2
  59. package/src/assets/icons/copyLink.svg +2 -2
  60. package/src/assets/icons/datahub.svg +2 -2
  61. package/src/assets/icons/deleteOutline.svg +3 -3
  62. package/src/assets/icons/deltagelsesgange.svg +2 -2
  63. package/src/assets/icons/dots.svg +4 -4
  64. package/src/assets/icons/dotsHorizontal.svg +2 -2
  65. package/src/assets/icons/doubleArrow.svg +2 -2
  66. package/src/assets/icons/downRightArrow.svg +2 -2
  67. package/src/assets/icons/download.svg +2 -2
  68. package/src/assets/icons/draggable.svg +5 -5
  69. package/src/assets/icons/email.svg +5 -5
  70. package/src/assets/icons/emner.svg +2 -2
  71. package/src/assets/icons/en_spalte.svg +3 -3
  72. package/src/assets/icons/envelopeFilled.svg +2 -2
  73. package/src/assets/icons/envelopeOutline.svg +4 -4
  74. package/src/assets/icons/error.svg +2 -2
  75. package/src/assets/icons/excel.svg +4 -4
  76. package/src/assets/icons/expandCircleRight.svg +3 -3
  77. package/src/assets/icons/eyeHide.svg +2 -2
  78. package/src/assets/icons/file.svg +5 -5
  79. package/src/assets/icons/filter.svg +2 -2
  80. package/src/assets/icons/filter2.svg +20 -20
  81. package/src/assets/icons/fire_spalter.svg +3 -3
  82. package/src/assets/icons/graph.svg +2 -2
  83. package/src/assets/icons/helpCircleOutline.svg +5 -5
  84. package/src/assets/icons/hero.svg +2 -2
  85. package/src/assets/icons/highlightArrow.svg +3 -3
  86. package/src/assets/icons/history.svg +2 -2
  87. package/src/assets/icons/home.svg +5 -5
  88. package/src/assets/icons/image.svg +5 -5
  89. package/src/assets/icons/indsaet.svg +2 -2
  90. package/src/assets/icons/indstillinger.svg +2 -2
  91. package/src/assets/icons/info.svg +4 -4
  92. package/src/assets/icons/infobox.svg +2 -2
  93. package/src/assets/icons/knap.svg +2 -2
  94. package/src/assets/icons/kontaktformular.svg +2 -2
  95. package/src/assets/icons/kopi.svg +2 -2
  96. package/src/assets/icons/leftUpCurvedArrow.svg +2 -2
  97. package/src/assets/icons/letter.svg +2 -2
  98. package/src/assets/icons/link.svg +2 -2
  99. package/src/assets/icons/linkboks.svg +4 -4
  100. package/src/assets/icons/linkedin.svg +5 -5
  101. package/src/assets/icons/liste.svg +2 -2
  102. package/src/assets/icons/listecard.svg +2 -2
  103. package/src/assets/icons/loading.svg +2 -2
  104. package/src/assets/icons/location.svg +2 -2
  105. package/src/assets/icons/lock.svg +6 -6
  106. package/src/assets/icons/loginbanner.svg +2 -2
  107. package/src/assets/icons/magnify.svg +2 -2
  108. package/src/assets/icons/magnifyBig.svg +2 -2
  109. package/src/assets/icons/map.svg +2 -2
  110. package/src/assets/icons/menu.svg +2 -2
  111. package/src/assets/icons/menuDown.svg +2 -2
  112. package/src/assets/icons/menuUp.svg +2 -2
  113. package/src/assets/icons/minus.svg +2 -2
  114. package/src/assets/icons/mitId.svg +3 -3
  115. package/src/assets/icons/notVerified.svg +2 -2
  116. package/src/assets/icons/notes.svg +5 -5
  117. package/src/assets/icons/online.svg +2 -2
  118. package/src/assets/icons/openInNew.svg +2 -2
  119. package/src/assets/icons/paere.svg +7 -7
  120. package/src/assets/icons/paginationChevronLeft.svg +4 -4
  121. package/src/assets/icons/paginationChevronRight.svg +4 -4
  122. package/src/assets/icons/paginationFirstPage.svg +4 -4
  123. package/src/assets/icons/paginationLastPage.svg +4 -4
  124. package/src/assets/icons/partnergruppe.svg +5 -5
  125. package/src/assets/icons/pause.svg +2 -2
  126. package/src/assets/icons/pdf.svg +4 -4
  127. package/src/assets/icons/pdfDownload.svg +2 -2
  128. package/src/assets/icons/pencil.svg +2 -2
  129. package/src/assets/icons/pencilOutline.svg +2 -2
  130. package/src/assets/icons/people.svg +4 -4
  131. package/src/assets/icons/phone.svg +5 -5
  132. package/src/assets/icons/play.svg +4 -4
  133. package/src/assets/icons/playVideo.svg +4 -4
  134. package/src/assets/icons/plus.svg +2 -2
  135. package/src/assets/icons/powerpoint.svg +4 -4
  136. package/src/assets/icons/praedefineretSoegning.svg +2 -2
  137. package/src/assets/icons/questionmark.svg +3 -3
  138. package/src/assets/icons/quote.svg +2 -2
  139. package/src/assets/icons/redaktion.svg +2 -2
  140. package/src/assets/icons/remove.svg +2 -2
  141. package/src/assets/icons/removeRedEyeOutline.svg +2 -2
  142. package/src/assets/icons/revert.svg +3 -3
  143. package/src/assets/icons/richtext.svg +2 -2
  144. package/src/assets/icons/roundCheckmark.svg +2 -2
  145. package/src/assets/icons/save.svg +2 -2
  146. package/src/assets/icons/sektionsoverskrift.svg +5 -5
  147. package/src/assets/icons/smal_bred.svg +3 -3
  148. package/src/assets/icons/starFilled.svg +2 -2
  149. package/src/assets/icons/starOutline.svg +2 -2
  150. package/src/assets/icons/tag.svg +2 -2
  151. package/src/assets/icons/teaser.svg +3 -3
  152. package/src/assets/icons/teaserbillede.svg +2 -2
  153. package/src/assets/icons/tekstgruppe.svg +2 -2
  154. package/src/assets/icons/time.svg +6 -6
  155. package/src/assets/icons/to_spalter.svg +3 -3
  156. package/src/assets/icons/top.svg +3 -3
  157. package/src/assets/icons/trashCan.svg +2 -2
  158. package/src/assets/icons/tre_spalter.svg +3 -3
  159. package/src/assets/icons/udvidedeCardgruppe.svg +2 -2
  160. package/src/assets/icons/unlock.svg +2 -2
  161. package/src/assets/icons/verified.svg +2 -2
  162. package/src/assets/icons/video.svg +2 -2
  163. package/src/assets/icons/word.svg +10 -10
  164. package/src/assets/icons/zoom.svg +2 -2
  165. package/src/components/VgAccordion.vue +97 -97
  166. package/src/components/VgButton.vue +18 -18
  167. package/src/components/VgButtons.vue +27 -27
  168. package/src/components/VgCard.vue +96 -96
  169. package/src/components/VgCardGroup.vue +18 -18
  170. package/src/components/VgDesignWrapper.vue +45 -45
  171. package/src/components/VgIcon.vue +54 -54
  172. package/src/components/VgKalturaVideo.vue +70 -70
  173. package/src/components/VgListe.vue +73 -73
  174. package/src/components/VgListeCard.vue +41 -41
  175. package/src/components/VgLoginButton.vue +7 -7
  176. package/src/components/VgPagination.vue +207 -207
  177. package/src/components/VgVideo.vue +59 -65
  178. package/src/components/VgVideoToolVideo.vue +70 -70
  179. package/src/styles/custom/_vgAccordion.scss +39 -39
  180. package/src/styles/custom/_vgCard.scss +15 -15
  181. package/src/styles/custom/_vgIcon.scss +3 -3
  182. package/src/styles/custom/_vgListe.scss +3 -3
  183. package/src/styles/custom/_vgVideo.scss +86 -86
  184. package/src/styles/custom/_vgVideoFrame.scss +9 -9
  185. package/src/styles/utility.scss +2 -2
  186. package/src/styles/vg/_vg-colors.scss +209 -209
  187. package/src/styles/vg/accordion/_vg-accordion.scss +140 -142
  188. package/src/styles/vg/buttons/_vg-buttons.scss +365 -365
  189. package/src/styles/vg/mixins/_vg-mediaquery-helpers.scss +159 -159
  190. package/src/styles/vg/pagination/_vg-pagination.scss +69 -69
  191. package/dist/src/components/VgVimeoVideo.vue.d.ts +0 -39
  192. package/dist/tests/unit/components/VgVimeoVideo.spec.d.ts +0 -1
  193. package/src/components/VgVimeoVideo.vue +0 -64
@@ -1,207 +1,207 @@
1
- <template>
2
- <nav class="pagination" :aria-label="$t('erhvervsfremme.content.application.pagination.label')">
3
- <div v-if="isMobile" class="mobile d-flex" data-testid="mobile-container">
4
- <button
5
- id="firstButton"
6
- class="button button-arrow button-first"
7
- :class="{ hidden: currentPage === 1 }"
8
- type="button"
9
- :aria-label="$t('erhvervsfremme.content.application.pagination.first.button.aria_label')"
10
- @click="toPage(1)"
11
- >
12
- <VgIcon icon="paginationFirstPage" focusable="false" aria-hidden="true" />
13
- </button>
14
- <button
15
- id="prevButton"
16
- class="button button-arrow button-previous"
17
- :class="{ hidden: currentPage === 1 }"
18
- type="button"
19
- :aria-label="$t('erhvervsfremme.content.application.pagination.previous.button.aria_label')"
20
- @click="prevPage"
21
- >
22
- <VgIcon icon="paginationChevronLeft" focusable="false" aria-hidden="true" />
23
- </button>
24
- <span class="pagination-mobile">{{ paginationMobile }}</span>
25
- <button
26
- id="nextButton"
27
- class="button button-arrow button-next"
28
- :class="{ hidden: currentPage === pageCount }"
29
- type="button"
30
- :aria-label="$t('erhvervsfremme.content.application.pagination.next.button.aria_label')"
31
- @click="nextPage"
32
- >
33
- <VgIcon icon="paginationChevronRight" focusable="false" aria-hidden="true" />
34
- </button>
35
- <button
36
- id="lastButton"
37
- class="button button-arrow button-last"
38
- :class="{ hidden: currentPage === pageCount }"
39
- type="button"
40
- :aria-label="$t('erhvervsfremme.content.application.pagination.last.button.aria_label')"
41
- @click="toPage(pageCount)"
42
- >
43
- <VgIcon icon="paginationLastPage" focusable="false" aria-hidden="true" />
44
- </button>
45
- </div>
46
- <template v-else>
47
- <!-- PREVIOUS BUTTON -->
48
- <button
49
- id="prevButton"
50
- class="button button-link mr-4"
51
- type="button"
52
- :class="{ hidden: currentPage === 1 }"
53
- :aria-label="$t('erhvervsfremme.content.application.pagination.backwards.button')"
54
- data-testid="button-forrige"
55
- @click="prevPage"
56
- >
57
- <VgIcon icon="paginationChevronLeft" focusable="false" aria-hidden="true" />
58
- {{ $t('erhvervsfremme.content.application.pagination.backwards.button') }}
59
- </button>
60
- <!-- BEFORE DOTS -->
61
- <template v-if="currentPage > 4">
62
- <button
63
- v-if="pageCount > 5"
64
- :id="`toPage-${1}`"
65
- class="button button-pagination"
66
- type="button"
67
- :aria-label="$t('erhvervsfremme.content.application.pagination.goto') + 1"
68
- @click="toPage(1)"
69
- >
70
- 1
71
- </button>
72
- <div v-if="pageCount > 6" class="dots">...</div>
73
- </template>
74
- <!-- BETWEEN DOTS -->
75
- <button
76
- v-for="pageNum in previousPages"
77
- :id="`toPage-${pageNum}`"
78
- :key="pageNum"
79
- class="button button-pagination"
80
- type="button"
81
- :aria-label="$t('erhvervsfremme.content.application.pagination.goto') + pageNum"
82
- @click="toPage(pageNum)"
83
- >
84
- {{ pageNum }}
85
- </button>
86
- <button
87
- :id="`toPage-${currentPage}`"
88
- class="button button-pagination button-active"
89
- type="button"
90
- :aria-label="$t('erhvervsfremme.content.application.pagination.currentpage') + currentPage"
91
- >
92
- {{ currentPage }}
93
- </button>
94
- <button
95
- v-for="pageNum in upcomingPages"
96
- :id="`toPage-${pageNum}`"
97
- :key="pageNum"
98
- class="button button-pagination"
99
- type="button"
100
- data-testid="button-step"
101
- :aria-label="$t('erhvervsfremme.content.application.pagination.goto') + pageNum"
102
- @click="toPage(pageNum)"
103
- >
104
- {{ pageNum }}
105
- </button>
106
- <!-- AFTER DOTS -->
107
- <template v-if="pageCount - currentPage > 3">
108
- <div v-if="pageCount > 6" class="dots">...</div>
109
- <button
110
- v-if="pageCount > 5"
111
- :id="`toPage-${pageCount}`"
112
- class="button button-pagination"
113
- type="button"
114
- :aria-label="$t('erhvervsfremme.content.application.pagination.goto') + pageCount"
115
- @click="toPage(pageCount)"
116
- >
117
- {{ pageCount }}
118
- </button>
119
- </template>
120
- <button
121
- id="nextButton"
122
- class="button button-link ml-0"
123
- type="button"
124
- :class="{ hidden: currentPage === pageCount }"
125
- data-testid="button-naeste"
126
- @click="nextPage"
127
- >
128
- {{ $t('erhvervsfremme.content.application.pagination.forwards.button') }}
129
- <VgIcon icon="paginationChevronRight" focusable="false" aria-hidden="true" />
130
- </button>
131
- </template>
132
- </nav>
133
- </template>
134
-
135
- <script setup lang="ts">
136
- import VgIcon from '@/components/VgIcon.vue';
137
- import { ParamType } from '@/utils/tekstnoegle-util';
138
- import range from 'lodash/range';
139
- import { computed, inject, onUnmounted, ref } from 'vue';
140
-
141
- const $t: (tekstnoegle: string, params?: ParamType) => string = inject('$t')!;
142
-
143
- const emits = defineEmits(['toPage']);
144
- const props = defineProps({
145
- currentPage: {
146
- type: Number,
147
- required: true
148
- },
149
- pageCount: {
150
- type: Number,
151
- required: true
152
- }
153
- });
154
-
155
- const paginationMobile = computed(() => $t('erhvervsfremme.content.application.pagination.mobile', [props.currentPage, props.pageCount]));
156
-
157
- const isMobile = computed(() => width.value < 768);
158
-
159
- const pagesAroundCurrent = computed((): number[] => {
160
- let first;
161
- if (props.currentPage < 5) {
162
- first = 1;
163
- } else if (props.pageCount - props.currentPage < 3) {
164
- first = props.pageCount - 4;
165
- } else {
166
- first = props.currentPage - 1;
167
- }
168
- let last;
169
- if (props.pageCount - props.currentPage < 4) {
170
- last = props.pageCount;
171
- } else if (props.currentPage < 5) {
172
- last = 5;
173
- } else {
174
- last = props.currentPage + 1;
175
- }
176
- return range(first, last + 1);
177
- });
178
-
179
- const previousPages = computed(() => pagesAroundCurrent.value.filter(num => num < props.currentPage));
180
- const upcomingPages = computed(() => pagesAroundCurrent.value.filter(num => num > props.currentPage));
181
-
182
- const prevPage = (): void => {
183
- if (props.currentPage > 1) {
184
- toPage(props.currentPage - 1);
185
- }
186
- };
187
- const nextPage = (): void => {
188
- if (props.currentPage < props.pageCount) {
189
- toPage(props.currentPage + 1);
190
- }
191
- };
192
- const toPage = (num: number): void => {
193
- emits('toPage', num);
194
- };
195
-
196
- const width = ref(window.innerWidth);
197
-
198
- const handleResize = (): void => {
199
- width.value = window.innerWidth;
200
- };
201
-
202
- window.addEventListener('resize', handleResize);
203
-
204
- onUnmounted(() => {
205
- window.removeEventListener('resize', handleResize);
206
- });
207
- </script>
1
+ <template>
2
+ <nav class="pagination" :aria-label="$t('erhvervsfremme.content.application.pagination.label')">
3
+ <div v-if="isMobile" class="mobile d-flex" data-testid="mobile-container">
4
+ <button
5
+ id="firstButton"
6
+ class="button button-arrow button-first"
7
+ :class="{ hidden: currentPage === 1 }"
8
+ type="button"
9
+ :aria-label="$t('erhvervsfremme.content.application.pagination.first.button.aria_label')"
10
+ @click="toPage(1)"
11
+ >
12
+ <VgIcon icon="paginationFirstPage" focusable="false" aria-hidden="true" />
13
+ </button>
14
+ <button
15
+ id="prevButton"
16
+ class="button button-arrow button-previous"
17
+ :class="{ hidden: currentPage === 1 }"
18
+ type="button"
19
+ :aria-label="$t('erhvervsfremme.content.application.pagination.previous.button.aria_label')"
20
+ @click="prevPage"
21
+ >
22
+ <VgIcon icon="paginationChevronLeft" focusable="false" aria-hidden="true" />
23
+ </button>
24
+ <span class="pagination-mobile">{{ paginationMobile }}</span>
25
+ <button
26
+ id="nextButton"
27
+ class="button button-arrow button-next"
28
+ :class="{ hidden: currentPage === pageCount }"
29
+ type="button"
30
+ :aria-label="$t('erhvervsfremme.content.application.pagination.next.button.aria_label')"
31
+ @click="nextPage"
32
+ >
33
+ <VgIcon icon="paginationChevronRight" focusable="false" aria-hidden="true" />
34
+ </button>
35
+ <button
36
+ id="lastButton"
37
+ class="button button-arrow button-last"
38
+ :class="{ hidden: currentPage === pageCount }"
39
+ type="button"
40
+ :aria-label="$t('erhvervsfremme.content.application.pagination.last.button.aria_label')"
41
+ @click="toPage(pageCount)"
42
+ >
43
+ <VgIcon icon="paginationLastPage" focusable="false" aria-hidden="true" />
44
+ </button>
45
+ </div>
46
+ <template v-else>
47
+ <!-- PREVIOUS BUTTON -->
48
+ <button
49
+ id="prevButton"
50
+ class="button button-link mr-4"
51
+ type="button"
52
+ :class="{ hidden: currentPage === 1 }"
53
+ :aria-label="$t('erhvervsfremme.content.application.pagination.backwards.button')"
54
+ data-testid="button-forrige"
55
+ @click="prevPage"
56
+ >
57
+ <VgIcon icon="paginationChevronLeft" focusable="false" aria-hidden="true" />
58
+ {{ $t('erhvervsfremme.content.application.pagination.backwards.button') }}
59
+ </button>
60
+ <!-- BEFORE DOTS -->
61
+ <template v-if="currentPage > 4">
62
+ <button
63
+ v-if="pageCount > 5"
64
+ :id="`toPage-${1}`"
65
+ class="button button-pagination"
66
+ type="button"
67
+ :aria-label="$t('erhvervsfremme.content.application.pagination.goto') + 1"
68
+ @click="toPage(1)"
69
+ >
70
+ 1
71
+ </button>
72
+ <div v-if="pageCount > 6" class="dots">...</div>
73
+ </template>
74
+ <!-- BETWEEN DOTS -->
75
+ <button
76
+ v-for="pageNum in previousPages"
77
+ :id="`toPage-${pageNum}`"
78
+ :key="pageNum"
79
+ class="button button-pagination"
80
+ type="button"
81
+ :aria-label="$t('erhvervsfremme.content.application.pagination.goto') + pageNum"
82
+ @click="toPage(pageNum)"
83
+ >
84
+ {{ pageNum }}
85
+ </button>
86
+ <button
87
+ :id="`toPage-${currentPage}`"
88
+ class="button button-pagination button-active"
89
+ type="button"
90
+ :aria-label="$t('erhvervsfremme.content.application.pagination.currentpage') + currentPage"
91
+ >
92
+ {{ currentPage }}
93
+ </button>
94
+ <button
95
+ v-for="pageNum in upcomingPages"
96
+ :id="`toPage-${pageNum}`"
97
+ :key="pageNum"
98
+ class="button button-pagination"
99
+ type="button"
100
+ data-testid="button-step"
101
+ :aria-label="$t('erhvervsfremme.content.application.pagination.goto') + pageNum"
102
+ @click="toPage(pageNum)"
103
+ >
104
+ {{ pageNum }}
105
+ </button>
106
+ <!-- AFTER DOTS -->
107
+ <template v-if="pageCount - currentPage > 3">
108
+ <div v-if="pageCount > 6" class="dots">...</div>
109
+ <button
110
+ v-if="pageCount > 5"
111
+ :id="`toPage-${pageCount}`"
112
+ class="button button-pagination"
113
+ type="button"
114
+ :aria-label="$t('erhvervsfremme.content.application.pagination.goto') + pageCount"
115
+ @click="toPage(pageCount)"
116
+ >
117
+ {{ pageCount }}
118
+ </button>
119
+ </template>
120
+ <button
121
+ id="nextButton"
122
+ class="button button-link ml-0"
123
+ type="button"
124
+ :class="{ hidden: currentPage === pageCount }"
125
+ data-testid="button-naeste"
126
+ @click="nextPage"
127
+ >
128
+ {{ $t('erhvervsfremme.content.application.pagination.forwards.button') }}
129
+ <VgIcon icon="paginationChevronRight" focusable="false" aria-hidden="true" />
130
+ </button>
131
+ </template>
132
+ </nav>
133
+ </template>
134
+
135
+ <script setup lang="ts">
136
+ import VgIcon from '@/components/VgIcon.vue';
137
+ import { ParamType } from '@/utils/tekstnoegle-util';
138
+ import range from 'lodash/range';
139
+ import { computed, inject, onUnmounted, ref } from 'vue';
140
+
141
+ const $t: (tekstnoegle: string, params?: ParamType) => string = inject('$t')!;
142
+
143
+ const emits = defineEmits(['toPage']);
144
+ const props = defineProps({
145
+ currentPage: {
146
+ type: Number,
147
+ required: true
148
+ },
149
+ pageCount: {
150
+ type: Number,
151
+ required: true
152
+ }
153
+ });
154
+
155
+ const paginationMobile = computed(() => $t('erhvervsfremme.content.application.pagination.mobile', [props.currentPage, props.pageCount]));
156
+
157
+ const isMobile = computed(() => width.value < 768);
158
+
159
+ const pagesAroundCurrent = computed((): number[] => {
160
+ let first;
161
+ if (props.currentPage < 5) {
162
+ first = 1;
163
+ } else if (props.pageCount - props.currentPage < 3) {
164
+ first = props.pageCount - 4;
165
+ } else {
166
+ first = props.currentPage - 1;
167
+ }
168
+ let last;
169
+ if (props.pageCount - props.currentPage < 4) {
170
+ last = props.pageCount;
171
+ } else if (props.currentPage < 5) {
172
+ last = 5;
173
+ } else {
174
+ last = props.currentPage + 1;
175
+ }
176
+ return range(first, last + 1);
177
+ });
178
+
179
+ const previousPages = computed(() => pagesAroundCurrent.value.filter(num => num < props.currentPage));
180
+ const upcomingPages = computed(() => pagesAroundCurrent.value.filter(num => num > props.currentPage));
181
+
182
+ const prevPage = (): void => {
183
+ if (props.currentPage > 1) {
184
+ toPage(props.currentPage - 1);
185
+ }
186
+ };
187
+ const nextPage = (): void => {
188
+ if (props.currentPage < props.pageCount) {
189
+ toPage(props.currentPage + 1);
190
+ }
191
+ };
192
+ const toPage = (num: number): void => {
193
+ emits('toPage', num);
194
+ };
195
+
196
+ const width = ref(window.innerWidth);
197
+
198
+ const handleResize = (): void => {
199
+ width.value = window.innerWidth;
200
+ };
201
+
202
+ window.addEventListener('resize', handleResize);
203
+
204
+ onUnmounted(() => {
205
+ window.removeEventListener('resize', handleResize);
206
+ });
207
+ </script>
@@ -1,65 +1,59 @@
1
- <template>
2
- <div class="video">
3
- <component :is="videoudbyder" :src="src" :alt="alt" :play-video="playVideo" class="video-player">
4
- <template #preview="{ thumbnailUrl }">
5
- <div v-if="!playVideo">
6
- <button class="button-wrapper" aria-label="Afspil video" title="Afspil video" type="button" @click="playVideo = true">
7
- <VgIcon icon="playVideo" />
8
- <div class="video-frame" :style="thumbnailUrl && { 'background-image': 'url(' + thumbnailUrl + ')' }" />
9
- </button>
10
- </div>
11
- </template>
12
- </component>
13
- <div class="cookie-banner">
14
- <!-- eslint-disable-next-line vue/no-v-html -->
15
- <div v-html="cookiebanner" />
16
- </div>
17
- </div>
18
- </template>
19
-
20
- <script setup lang="ts">
21
- import VgIcon from '@/components/VgIcon.vue';
22
- import VgKalturaVideo from '@/components/VgKalturaVideo.vue';
23
- import VgVideoToolVideo from '@/components/VgVideoToolVideo.vue';
24
- import VgVimeoVideo from '@/components/VgVimeoVideo.vue';
25
- import { computed, ref } from 'vue';
26
-
27
- const components = {
28
- VgVimeoVideo,
29
- VgVideoToolVideo,
30
- VgKalturaVideo
31
- };
32
-
33
- const props = defineProps({
34
- src: {
35
- type: String,
36
- required: true
37
- },
38
- alt: {
39
- type: String,
40
- required: true
41
- },
42
- cookiebanner: {
43
- type: String,
44
- required: true
45
- }
46
- });
47
-
48
- const playVideo = ref(false);
49
-
50
- const videoudbyder = computed(() => {
51
- if (props.src.includes('vimeo')) {
52
- return components.VgVimeoVideo;
53
- } else if (props.src.includes('videotool')) {
54
- return components.VgVideoToolVideo;
55
- } else if (props.src.includes('kaltura')) {
56
- return components.VgKalturaVideo;
57
- }
58
- return '';
59
- });
60
- </script>
61
-
62
- <style lang="scss" scoped>
63
- @use '@/styles/custom/_vgVideo.scss';
64
- @use '@/styles/custom/_vgVideoFrame.scss';
65
- </style>
1
+ <template>
2
+ <div class="video">
3
+ <component :is="videoudbyder" :src="src" :alt="alt" :play-video="playVideo" class="video-player">
4
+ <template #preview="{ thumbnailUrl }">
5
+ <div v-if="!playVideo">
6
+ <button class="button-wrapper" aria-label="Afspil video" title="Afspil video" type="button" @click="playVideo = true">
7
+ <VgIcon icon="playVideo" />
8
+ <div class="video-frame" :style="thumbnailUrl && { 'background-image': 'url(' + thumbnailUrl + ')' }" />
9
+ </button>
10
+ </div>
11
+ </template>
12
+ </component>
13
+ <div class="cookie-banner">
14
+ <em>
15
+ NB: Udbyderen af servicen kan sætte en eller flere cookies, når du afspiller eller deler videoen.
16
+ <a href="/content/cookies/" target="_blank">Læs om cookies</a>
17
+ </em>
18
+ </div>
19
+ </div>
20
+ </template>
21
+
22
+ <script setup lang="ts">
23
+ import VgIcon from '@/components/VgIcon.vue';
24
+ import VgKalturaVideo from '@/components/VgKalturaVideo.vue';
25
+ import VgVideoToolVideo from '@/components/VgVideoToolVideo.vue';
26
+ import { computed, ref } from 'vue';
27
+
28
+ const components = {
29
+ VgVideoToolVideo,
30
+ VgKalturaVideo
31
+ };
32
+
33
+ const props = defineProps({
34
+ src: {
35
+ type: String,
36
+ required: true
37
+ },
38
+ alt: {
39
+ type: String,
40
+ required: true
41
+ }
42
+ });
43
+
44
+ const playVideo = ref(false);
45
+
46
+ const videoudbyder = computed(() => {
47
+ if (props.src.includes('videotool')) {
48
+ return components.VgVideoToolVideo;
49
+ } else if (props.src.includes('kaltura')) {
50
+ return components.VgKalturaVideo;
51
+ }
52
+ return '';
53
+ });
54
+ </script>
55
+
56
+ <style lang="scss" scoped>
57
+ @use '@/styles/custom/_vgVideo.scss';
58
+ @use '@/styles/custom/_vgVideoFrame.scss';
59
+ </style>