master
km0 2 years ago
parent b7e60025a0
commit 8b0e338e70

@ -9,6 +9,8 @@ export default {
const currentSort = ref("date"); const currentSort = ref("date");
const currentSortDir = ref("desc"); const currentSortDir = ref("desc");
const tags = ref([]);
const sortedPads = computed(() => { const sortedPads = computed(() => {
return pads.value.sort((a, b) => { return pads.value.sort((a, b) => {
let modifier = 1; let modifier = 1;
@ -46,6 +48,17 @@ export default {
.then((res) => res.json()) .then((res) => res.json())
.then((data) => { .then((data) => {
pads.value = data.pads; pads.value = data.pads;
pads.value.map(
(pad) =>
(pad.categories = pad.categories
.split(",")
.map((category) => category.trim()))
);
tags.value = Array.from(
new Set([...pads.value.map((pad) => pad.categories)].flat())
).sort();
currentPage.value = data.page; currentPage.value = data.page;
loaded.value = true; loaded.value = true;
}); });
@ -58,38 +71,53 @@ export default {
currentSort, currentSort,
currentSortDir, currentSortDir,
loaded, loaded,
tags,
sort, sort,
formatDate, formatDate,
}; };
}, },
template: ` template: `
<div v-if="!loaded" class='loading grow'> <div v-if="!loaded" class='loading grow'>
Loading loading loading loading loading loading loading loading loading loading loading loading loading loading loading loading loading loading etc Loading loading loading loading loading loading loading loading loading loading loading loading loading loading loading loading loading loading etc
</div> </div>
<div v-else> <div v-else>
<div class="filter">
<h2>Filter Categories</h2>
<ul>
<li v-for="tag in tags" :key="tag">{{tag}}</li>
</ul>
</div>
<p class="from">Fetching pads from <a :href="'https://pzwiki.wdka.nl/mediadesign/' + currentPage"> <p class="from">
{{currentPage}} Fetching pads from
</a> <a :href="'https://pzwiki.wdka.nl/mediadesign/' + currentPage">{{currentPage}}</a>
</p> </p>
<table> <table>
<tr class="header"> <tr class="header">
<th v-for="column in columns" @click='sort(column)'> <th v-for="column in columns" :class="column" @click='sort(column)'>
{{column }} {{column }}
<span v-if='column == currentSort'> {{ currentSortDir == 'asc' ? '▼' : '▲'}}</span> <span v-if='column == currentSort'> {{ currentSortDir == 'asc' ? '▼' : '▲'}}</span>
</th> </th>
</tr> </tr>
<tr v-for="(pad, index) in sortedPads" key="pad.title, index" :class="pad.category"> <tr v-for="(pad, index) in sortedPads" key="pad.title, index" :class="pad.category">
<td class="title"> <td class="title">
<a :href="pad.link" class='stretched' target="_blank"> {{pad.title}} </a> <a :href="pad.link" class='stretched' target="_blank"> {{pad.title}} </a>
</td> </td>
<td class="overview">{{pad.overview}}</td> <td class="overview">
<td class="categories">{{pad.categories}}</td> <p>
{{pad.overview}}
</p>
</td>
<td class="categories">
<span class="category" v-for="category in pad.categories" :key="category">{{category}}</span>
</td>
<td class="date">{{formatDate(pad.date)}}</td> <td class="date">{{formatDate(pad.date)}}</td>
</tr> </tr>

@ -1,3 +1,8 @@
:root {
--bg: #000000;
--color: dodgerblue;
}
* { * {
box-sizing: border-box; box-sizing: border-box;
} }
@ -6,7 +11,8 @@ html,
body { body {
font-family: Arial, Helvetica, sans-serif; font-family: Arial, Helvetica, sans-serif;
line-height: 1.6; line-height: 1.6;
color: dodgerblue; color: var(--color);
background-color: var(--bg);
} }
a { a {
@ -24,6 +30,7 @@ input {
outline: none; outline: none;
padding: 0.4em; padding: 0.4em;
margin: 0; margin: 0;
background: none;
} }
input.overview { input.overview {
@ -57,8 +64,8 @@ button.submit {
} }
button:hover { button:hover {
background-color: dodgerblue; background-color: var(--color);
color: white; color: var(--bg);
} }
*:not(h2) + input { *:not(h2) + input {
@ -69,8 +76,8 @@ button:hover {
display: inline-block; display: inline-block;
padding-left: 12px; padding-left: 12px;
border-left: 1px solid currentColor; border-left: 1px solid currentColor;
margin-top: 32px; margin-top: 12px;
margin-bottom: 48px; margin-bottom: 12px;
} }
.app-form h2 { .app-form h2 {
@ -86,18 +93,25 @@ table a {
text-decoration: none; text-decoration: none;
} }
tr.header {
position: sticky;
top: 0;
background-color: var(--bg);
z-index: 100;
}
th { th {
text-align: left; text-align: left;
padding: 24px 0; padding: 24px 0;
border-bottom: 1px solid currentColor; border-bottom: 1px solid currentColor;
text-transform: capitalize; text-transform: capitalize;
font-size: 28px; font-size: 21px;
user-select: none; user-select: none;
cursor: pointer; cursor: pointer;
} }
td { td {
padding: 12px 0; padding: 12px;
border-bottom: 1px solid currentColor; border-bottom: 1px solid currentColor;
} }
@ -105,6 +119,15 @@ td.title {
font-weight: bold; font-weight: bold;
} }
td.overview,
th.overview {
flex-grow: 3;
}
td.overview p {
margin: 0;
}
tr { tr {
position: relative; position: relative;
transition: transform 0.1s ease-in; transition: transform 0.1s ease-in;
@ -131,6 +154,79 @@ tr:hover:not(:first-of-type) {
.grow { .grow {
animation: grow 5s; animation: grow 5s;
} }
.filter {
padding-left: 12px;
border-left: 1px solid currentColor;
margin-top: 32px;
margin-bottom: 48px;
}
.filter h2 {
font-weight: normal;
margin: 0;
margin-bottom: 8px;
}
.filter ul {
display: flex;
flex-wrap: wrap;
list-style: none;
gap: 8px;
margin: 0;
padding: 0;
}
.filter ul li,
.category {
display: inline-block;
border: 1px solid currentColor;
padding: 0 4px;
}
tr {
display: flex;
justify-content: space-between;
}
th,
td {
padding: 12px 12px;
}
th:first-of-type,
td:first-child {
padding-left: 0;
}
th:last-of-type,
td:last-child {
padding-right: 0;
}
th.date,
td.date {
flex-grow: 0.4;
margin-left: auto;
}
tr > * {
flex: 1;
}
td.categories {
align-content: flex-start;
display: flex;
flex-wrap: wrap;
gap: 8px;
height: auto;
}
.categories .category {
border: none;
}
@keyframes grow { @keyframes grow {
from { from {
transform: scale(100%); transform: scale(100%);

Loading…
Cancel
Save