tecitheme 0.0.21 → 0.0.22
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/components/NewsGrid.svelte +31 -6
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { DateTime } from 'luxon';
|
|
3
3
|
import { getContext } from 'svelte';
|
|
4
4
|
import { paginate, PaginationNav } from 'svelte-paginate';
|
|
5
|
+
import Icon from './Icon.svelte'
|
|
5
6
|
|
|
6
7
|
export let data;
|
|
7
8
|
|
|
@@ -13,9 +14,13 @@
|
|
|
13
14
|
let pageSize = data.pageSize;
|
|
14
15
|
|
|
15
16
|
function termExists(arr, terms) {
|
|
16
|
-
|
|
17
|
-
return
|
|
18
|
-
|
|
17
|
+
if (arr) {
|
|
18
|
+
return terms.some((term) => {
|
|
19
|
+
return arr.includes(term);
|
|
20
|
+
});
|
|
21
|
+
} else {
|
|
22
|
+
return false
|
|
23
|
+
}
|
|
19
24
|
}
|
|
20
25
|
|
|
21
26
|
function filterPosts(arr, terms) {
|
|
@@ -38,7 +43,7 @@
|
|
|
38
43
|
$: paginatedItems = paginate({ items, pageSize, currentPage });
|
|
39
44
|
</script>
|
|
40
45
|
|
|
41
|
-
<div class="relative mx-auto
|
|
46
|
+
<div class="relative w-full mx-auto">
|
|
42
47
|
<div
|
|
43
48
|
class="flex flex-col justify-between space-y-4 border-b-2 border-gray-200 pb-4 sm:flex-row sm:items-end sm:space-y-0"
|
|
44
49
|
>
|
|
@@ -67,6 +72,7 @@
|
|
|
67
72
|
>
|
|
68
73
|
</div>
|
|
69
74
|
</div>
|
|
75
|
+
{#if (items.length > 0)}
|
|
70
76
|
<div class="paginator mx-auto flex justify-center pt-4">
|
|
71
77
|
<PaginationNav
|
|
72
78
|
totalItems="{items.length}"
|
|
@@ -81,8 +87,9 @@
|
|
|
81
87
|
class="grid gap-16 pt-8 md:grid-cols-2 lg:grid-cols-3 lg:gap-x-5 lg:gap-y-12"
|
|
82
88
|
>
|
|
83
89
|
{#each paginatedItems as post}
|
|
84
|
-
|
|
85
|
-
|
|
90
|
+
<div class="h-full">
|
|
91
|
+
<a class="block" href="/{post.path}">
|
|
92
|
+
<div class="h-full flex flex-col items-stretch ">
|
|
86
93
|
<time
|
|
87
94
|
class="mb-1 block text-sm text-gray-500"
|
|
88
95
|
datetime="{post.meta.date}"
|
|
@@ -102,6 +109,15 @@
|
|
|
102
109
|
Missing Summary Text
|
|
103
110
|
</p>
|
|
104
111
|
{/if}
|
|
112
|
+
{#if post.meta.categories}
|
|
113
|
+
<div class="w-full mb-2 text-sm flex flex-row">
|
|
114
|
+
{#each (post.meta.categories.sort()) as term}
|
|
115
|
+
<a class="inline-block mr-2" href="/news/{term}" rel="external">
|
|
116
|
+
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs bg-teci-blue-dark text-white">{term}</span>
|
|
117
|
+
</a>
|
|
118
|
+
{/each}
|
|
119
|
+
</div>
|
|
120
|
+
{/if}
|
|
105
121
|
<p
|
|
106
122
|
class="text-sm font-semibold text-teci-blue-light hover:text-teci-blue-dark"
|
|
107
123
|
>
|
|
@@ -109,6 +125,7 @@
|
|
|
109
125
|
</p>
|
|
110
126
|
</div>
|
|
111
127
|
</a>
|
|
128
|
+
</div>
|
|
112
129
|
{/each}
|
|
113
130
|
</div>
|
|
114
131
|
<div class="paginator mx-auto flex justify-center pt-8">
|
|
@@ -121,4 +138,12 @@
|
|
|
121
138
|
on:setPage="{(e) => (currentPage = e.detail.page)}"
|
|
122
139
|
/>
|
|
123
140
|
</div>
|
|
141
|
+
{:else}
|
|
142
|
+
<div class="prose">
|
|
143
|
+
<p class="pt-8">
|
|
144
|
+
Sorry, there isn't any news for you to see here.<br>
|
|
145
|
+
Please visit the <a rel="external" href="/news">All News</a> page for an updated list.
|
|
146
|
+
</p>
|
|
147
|
+
</div>
|
|
148
|
+
{/if}
|
|
124
149
|
</div>
|