@erst-vg/vg-design-wrapper 1.0.8 → 1.0.10

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 (187) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +2 -2
  3. package/dist/src/components/VgCard.vue.d.ts +31 -23
  4. package/dist/src/components/VgLoginButton.vue.d.ts +2 -0
  5. package/dist/src/index.d.ts +2 -1
  6. package/dist/tests/unit/components/VgLoginButton.spec.d.ts +1 -0
  7. package/dist/vg-design-wrapper.js +1052 -1033
  8. package/dist/vg-design-wrapper.umd.cjs +50 -50
  9. package/package.json +92 -92
  10. package/src/assets/icons/abonnementFilled.svg +4 -4
  11. package/src/assets/icons/abonnementOutline.svg +4 -4
  12. package/src/assets/icons/accordion.svg +2 -2
  13. package/src/assets/icons/accordionClose.svg +2 -2
  14. package/src/assets/icons/accordionCloseOld.svg +6 -6
  15. package/src/assets/icons/accordionOpen.svg +3 -3
  16. package/src/assets/icons/accordionOpenOld.svg +6 -6
  17. package/src/assets/icons/accountCircle.svg +2 -2
  18. package/src/assets/icons/add.svg +5 -5
  19. package/src/assets/icons/addBig.svg +5 -5
  20. package/src/assets/icons/afpublicer.svg +2 -2
  21. package/src/assets/icons/anchorlink.svg +3 -3
  22. package/src/assets/icons/anchormenuer.svg +3 -3
  23. package/src/assets/icons/anden.svg +3 -0
  24. package/src/assets/icons/angleArrowDown.svg +2 -2
  25. package/src/assets/icons/angleArrowUp.svg +2 -2
  26. package/src/assets/icons/ansoegninger.svg +6 -6
  27. package/src/assets/icons/antal-gange.svg +6 -6
  28. package/src/assets/icons/applikationer.svg +2 -2
  29. package/src/assets/icons/arrowLeft.svg +2 -2
  30. package/src/assets/icons/arrowRight.svg +2 -2
  31. package/src/assets/icons/bell.svg +2 -2
  32. package/src/assets/icons/bellAlarmFilled.svg +2 -2
  33. package/src/assets/icons/bellAlarmOutline.svg +2 -2
  34. package/src/assets/icons/bellOvercrossed.svg +2 -2
  35. package/src/assets/icons/beskedcenter.svg +2 -2
  36. package/src/assets/icons/billede.svg +2 -2
  37. package/src/assets/icons/bogmaerker.svg +2 -2
  38. package/src/assets/icons/bookmarkFilled.svg +2 -2
  39. package/src/assets/icons/bookmarkOutline.svg +2 -2
  40. package/src/assets/icons/breadcrumbArrow.svg +3 -3
  41. package/src/assets/icons/bred_smal.svg +3 -0
  42. package/src/assets/icons/cSRDAddDatapunkt.svg +5 -0
  43. package/src/assets/icons/cSRDAddMultipleDatapunkter.svg +7 -0
  44. package/src/assets/icons/cSRDLockedDatapunkt.svg +4 -0
  45. package/src/assets/icons/cSRDRemoveDatapunkt.svg +5 -0
  46. package/src/assets/icons/cSRDRemoveDatapunktOversigt.svg +4 -0
  47. package/src/assets/icons/calendar.svg +2 -2
  48. package/src/assets/icons/calendarOutline.svg +2 -2
  49. package/src/assets/icons/callToAction.svg +2 -2
  50. package/src/assets/icons/card.svg +2 -2
  51. package/src/assets/icons/carouselArrowLeft.svg +2 -2
  52. package/src/assets/icons/carouselArrowRight.svg +2 -2
  53. package/src/assets/icons/category.svg +2 -2
  54. package/src/assets/icons/center.svg +3 -0
  55. package/src/assets/icons/check.svg +2 -2
  56. package/src/assets/icons/chevronLeft.svg +2 -2
  57. package/src/assets/icons/circularArrow.svg +3 -3
  58. package/src/assets/icons/close.svg +2 -2
  59. package/src/assets/icons/closeCircleOutline.svg +2 -2
  60. package/src/assets/icons/closeCirleFilled.svg +2 -2
  61. package/src/assets/icons/copyLink.svg +2 -2
  62. package/src/assets/icons/datahub.svg +2 -2
  63. package/src/assets/icons/deleteOutline.svg +3 -3
  64. package/src/assets/icons/deltagelsesgange.svg +2 -2
  65. package/src/assets/icons/dots.svg +4 -4
  66. package/src/assets/icons/dotsHorizontal.svg +2 -2
  67. package/src/assets/icons/doubleArrow.svg +2 -2
  68. package/src/assets/icons/downRightArrow.svg +2 -2
  69. package/src/assets/icons/download.svg +2 -2
  70. package/src/assets/icons/draggable.svg +5 -5
  71. package/src/assets/icons/email.svg +5 -5
  72. package/src/assets/icons/emner.svg +2 -2
  73. package/src/assets/icons/en_spalte.svg +3 -0
  74. package/src/assets/icons/envelopeFilled.svg +2 -2
  75. package/src/assets/icons/envelopeOutline.svg +4 -4
  76. package/src/assets/icons/error.svg +2 -2
  77. package/src/assets/icons/excel.svg +4 -0
  78. package/src/assets/icons/expandCircleRight.svg +3 -0
  79. package/src/assets/icons/eyeHide.svg +2 -2
  80. package/src/assets/icons/file.svg +5 -5
  81. package/src/assets/icons/filter.svg +2 -2
  82. package/src/assets/icons/filter2.svg +20 -20
  83. package/src/assets/icons/fire_spalter.svg +3 -0
  84. package/src/assets/icons/graph.svg +2 -2
  85. package/src/assets/icons/helpCircleOutline.svg +5 -5
  86. package/src/assets/icons/hero.svg +2 -2
  87. package/src/assets/icons/highlightArrow.svg +3 -3
  88. package/src/assets/icons/history.svg +2 -2
  89. package/src/assets/icons/home.svg +5 -5
  90. package/src/assets/icons/image.svg +5 -5
  91. package/src/assets/icons/indsaet.svg +2 -2
  92. package/src/assets/icons/indstillinger.svg +2 -2
  93. package/src/assets/icons/info.svg +4 -4
  94. package/src/assets/icons/infobox.svg +2 -2
  95. package/src/assets/icons/knap.svg +2 -2
  96. package/src/assets/icons/kontaktformular.svg +2 -2
  97. package/src/assets/icons/kopi.svg +2 -2
  98. package/src/assets/icons/leftUpCurvedArrow.svg +2 -2
  99. package/src/assets/icons/letter.svg +2 -2
  100. package/src/assets/icons/link.svg +2 -2
  101. package/src/assets/icons/linkboks.svg +4 -4
  102. package/src/assets/icons/linkedin.svg +5 -5
  103. package/src/assets/icons/liste.svg +2 -2
  104. package/src/assets/icons/listecard.svg +2 -2
  105. package/src/assets/icons/loading.svg +2 -2
  106. package/src/assets/icons/location.svg +2 -2
  107. package/src/assets/icons/lock.svg +6 -6
  108. package/src/assets/icons/loginbanner.svg +2 -2
  109. package/src/assets/icons/magnify.svg +2 -2
  110. package/src/assets/icons/magnifyBig.svg +2 -2
  111. package/src/assets/icons/map.svg +2 -2
  112. package/src/assets/icons/menu.svg +2 -2
  113. package/src/assets/icons/menuDown.svg +2 -2
  114. package/src/assets/icons/menuUp.svg +2 -2
  115. package/src/assets/icons/minus.svg +2 -2
  116. package/src/assets/icons/mitId.svg +8 -0
  117. package/src/assets/icons/notVerified.svg +2 -2
  118. package/src/assets/icons/notes.svg +5 -5
  119. package/src/assets/icons/online.svg +2 -2
  120. package/src/assets/icons/openInNew.svg +2 -2
  121. package/src/assets/icons/paere.svg +7 -7
  122. package/src/assets/icons/paginationChevronLeft.svg +4 -4
  123. package/src/assets/icons/paginationChevronRight.svg +4 -4
  124. package/src/assets/icons/paginationFirstPage.svg +4 -4
  125. package/src/assets/icons/paginationLastPage.svg +4 -4
  126. package/src/assets/icons/partnergruppe.svg +5 -5
  127. package/src/assets/icons/pause.svg +2 -2
  128. package/src/assets/icons/pdf.svg +4 -0
  129. package/src/assets/icons/pdfDownload.svg +2 -2
  130. package/src/assets/icons/pencil.svg +2 -2
  131. package/src/assets/icons/pencilOutline.svg +2 -2
  132. package/src/assets/icons/people.svg +4 -4
  133. package/src/assets/icons/phone.svg +5 -5
  134. package/src/assets/icons/play.svg +4 -4
  135. package/src/assets/icons/playVideo.svg +4 -4
  136. package/src/assets/icons/plus.svg +2 -2
  137. package/src/assets/icons/powerpoint.svg +4 -0
  138. package/src/assets/icons/praedefineretSoegning.svg +2 -2
  139. package/src/assets/icons/questionmark.svg +3 -0
  140. package/src/assets/icons/quote.svg +2 -2
  141. package/src/assets/icons/redaktion.svg +2 -2
  142. package/src/assets/icons/remove.svg +2 -2
  143. package/src/assets/icons/removeRedEyeOutline.svg +2 -2
  144. package/src/assets/icons/revert.svg +3 -0
  145. package/src/assets/icons/richtext.svg +2 -2
  146. package/src/assets/icons/roundCheckmark.svg +2 -2
  147. package/src/assets/icons/save.svg +2 -2
  148. package/src/assets/icons/sektionsoverskrift.svg +5 -5
  149. package/src/assets/icons/smal_bred.svg +3 -0
  150. package/src/assets/icons/starFilled.svg +2 -2
  151. package/src/assets/icons/starOutline.svg +2 -2
  152. package/src/assets/icons/tag.svg +2 -2
  153. package/src/assets/icons/teaser.svg +3 -3
  154. package/src/assets/icons/teaserbillede.svg +2 -2
  155. package/src/assets/icons/tekstgruppe.svg +2 -2
  156. package/src/assets/icons/time.svg +6 -6
  157. package/src/assets/icons/to_spalter.svg +3 -0
  158. package/src/assets/icons/top.svg +3 -0
  159. package/src/assets/icons/trashCan.svg +2 -2
  160. package/src/assets/icons/tre_spalter.svg +3 -0
  161. package/src/assets/icons/udvidedeCardgruppe.svg +2 -2
  162. package/src/assets/icons/unlock.svg +2 -2
  163. package/src/assets/icons/verified.svg +2 -2
  164. package/src/assets/icons/video.svg +2 -2
  165. package/src/assets/icons/word.svg +10 -0
  166. package/src/assets/icons/zoom.svg +2 -2
  167. package/src/components/VgAccordion.vue +97 -97
  168. package/src/components/VgButton.vue +18 -18
  169. package/src/components/VgButtons.vue +27 -27
  170. package/src/components/VgCard.vue +96 -92
  171. package/src/components/VgCardGroup.vue +18 -18
  172. package/src/components/VgDesignWrapper.vue +48 -48
  173. package/src/components/VgIcon.vue +54 -54
  174. package/src/components/VgListe.vue +73 -73
  175. package/src/components/VgListeCard.vue +41 -41
  176. package/src/components/VgLoginButton.vue +7 -0
  177. package/src/components/VgPagination.vue +207 -207
  178. package/src/styles/custom/_vgAccordion.scss +38 -38
  179. package/src/styles/custom/_vgCard.scss +15 -15
  180. package/src/styles/custom/_vgIcon.scss +3 -3
  181. package/src/styles/custom/_vgListe.scss +3 -3
  182. package/src/styles/vg/_vg-colors.scss +206 -202
  183. package/src/styles/vg/accordion/_vg-accordion.scss +111 -111
  184. package/src/styles/vg/buttons/_vg-buttons.scss +356 -332
  185. package/src/styles/vg/card/_vg-udvidedecardgrupper.scss +20 -2
  186. package/src/styles/vg/mixins/_vg-mediaquery-helpers.scss +152 -152
  187. package/src/styles/vg/pagination/_vg-pagination.scss +67 -67
@@ -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,38 +1,38 @@
1
- .vg-accordion {
2
- .accordion-button {
3
- &[aria-expanded='true'] {
4
- .open {
5
- display: none;
6
- }
7
- }
8
- &[aria-expanded='false'] {
9
- .close {
10
- display: none;
11
- }
12
- }
13
- }
14
-
15
- .top-wrapper {
16
- h1,
17
- h2,
18
- h3,
19
- h4,
20
- h5,
21
- h6 {
22
- max-width: 100%;
23
- }
24
- }
25
- }
26
-
27
- .accordion-bulk-button {
28
- display: block;
29
- line-height: 1.5em;
30
- padding-left: 0;
31
- margin-left: auto;
32
- background-image: none !important;
33
- color: var(--site-primary);
34
-
35
- &:focus {
36
- color: var(--site-primary);
37
- }
38
- }
1
+ .vg-accordion {
2
+ .accordion-button {
3
+ &[aria-expanded='true'] {
4
+ .open {
5
+ display: none;
6
+ }
7
+ }
8
+ &[aria-expanded='false'] {
9
+ .close {
10
+ display: none;
11
+ }
12
+ }
13
+ }
14
+
15
+ .top-wrapper {
16
+ h1,
17
+ h2,
18
+ h3,
19
+ h4,
20
+ h5,
21
+ h6 {
22
+ max-width: 100%;
23
+ }
24
+ }
25
+ }
26
+
27
+ .accordion-bulk-button {
28
+ display: block;
29
+ line-height: 1.5em;
30
+ padding-left: 0;
31
+ margin-left: auto;
32
+ background-image: none !important;
33
+ color: var(--site-primary);
34
+
35
+ &:focus {
36
+ color: var(--site-primary);
37
+ }
38
+ }
@@ -1,15 +1,15 @@
1
- .text {
2
- pre {
3
- white-space: pre-line;
4
- }
5
- }
6
-
7
- .udvidet-cardgruppe-card {
8
- &:hover {
9
- h3,
10
- .card-titel {
11
- text-decoration: underline;
12
- color: var(--link-color);
13
- }
14
- }
15
- }
1
+ .text {
2
+ pre {
3
+ white-space: pre-line;
4
+ }
5
+ }
6
+
7
+ .udvidet-cardgruppe-card {
8
+ &:hover {
9
+ h3,
10
+ .card-titel {
11
+ text-decoration: underline;
12
+ color: var(--link-color);
13
+ }
14
+ }
15
+ }
@@ -1,3 +1,3 @@
1
- .icon {
2
- fill: currentColor;
3
- }
1
+ .icon {
2
+ fill: currentColor;
3
+ }
@@ -1,3 +1,3 @@
1
- .centered-button {
2
- margin: 24px auto 0px !important;
3
- }
1
+ .centered-button {
2
+ margin: 24px auto 0px !important;
3
+ }