mirror of
https://github.com/ivabus/www
synced 2024-11-22 15:35:05 +03:00
#190 add a package list page at '/+/'
This commit is contained in:
parent
9f2f479eb7
commit
1dedd671d7
3 changed files with 47 additions and 2 deletions
5
src/content/+.md
Normal file
5
src/content/+.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
type: page
|
||||||
|
title: "packages"
|
||||||
|
layout: "packages"
|
||||||
|
---
|
33
src/layouts/page/packages.html
Normal file
33
src/layouts/page/packages.html
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
{{ define "main" }}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Package Grid -->
|
||||||
|
|
||||||
|
<!-- Desktop/Tablet Package Display -->
|
||||||
|
|
||||||
|
<span>
|
||||||
|
{{- partial "package-grid.html" . -}}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<!-- Mobile Package Display -->
|
||||||
|
<!-- dont remove, it is not completely useless there is a ui bug i couldnt figure out
|
||||||
|
the only solution is to keep it here. sorry - neil
|
||||||
|
-->
|
||||||
|
<span class="swiper-package-display">
|
||||||
|
{{- partial "swiper.html" . -}}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<!-- Style for Swiper -->
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.grid-package-display{
|
||||||
|
display:block;
|
||||||
|
}
|
||||||
|
.swiper-package-display {
|
||||||
|
/* dont remove refer to comment above */
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
{{ end }}
|
|
@ -39,7 +39,7 @@
|
||||||
}
|
}
|
||||||
.package-grid {
|
.package-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: auto auto;
|
grid-template-columns: auto;
|
||||||
}
|
}
|
||||||
#loadMorePackagesBtn {
|
#loadMorePackagesBtn {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
@ -98,6 +98,8 @@
|
||||||
popularity: 'popularity',
|
popularity: 'popularity',
|
||||||
last_modified: 'last_modified',
|
last_modified: 'last_modified',
|
||||||
}
|
}
|
||||||
|
const showAllPackages = window.location.pathname.includes("/+/");
|
||||||
|
|
||||||
let sortBy = sortOptions.popularity; // last_modified
|
let sortBy = sortOptions.popularity; // last_modified
|
||||||
let sortDirection = 'desc'; // asc
|
let sortDirection = 'desc'; // asc
|
||||||
let limit = 16;
|
let limit = 16;
|
||||||
|
@ -186,7 +188,7 @@
|
||||||
const packages = getPackageThumbs();
|
const packages = getPackageThumbs();
|
||||||
let i = 0;
|
let i = 0;
|
||||||
for(const sp of packages) {
|
for(const sp of packages) {
|
||||||
if (i >= limit) {
|
if (i >= limit && !showAllPackages) {
|
||||||
sp.classList.add('hidden');
|
sp.classList.add('hidden');
|
||||||
} else {
|
} else {
|
||||||
sp.classList.remove('hidden');
|
sp.classList.remove('hidden');
|
||||||
|
@ -204,6 +206,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const loadMoreButton = document.getElementById('loadMorePackagesBtn');
|
const loadMoreButton = document.getElementById('loadMorePackagesBtn');
|
||||||
|
if (showAllPackages) {
|
||||||
|
loadMoreSection.classList.add('hidden');
|
||||||
|
} else {
|
||||||
|
loadMoreSection.classList.remove('hidden');
|
||||||
|
}
|
||||||
loadMoreButton.addEventListener('click',() => {
|
loadMoreButton.addEventListener('click',() => {
|
||||||
limit += 16;
|
limit += 16;
|
||||||
refreshDisplayedPackages();
|
refreshDisplayedPackages();
|
||||||
|
|
Loading…
Reference in a new issue