diff --git a/src/static/tailwind.css b/src/static/tailwind.css index 8603984..b67ff98 100644 --- a/src/static/tailwind.css +++ b/src/static/tailwind.css @@ -662,9 +662,6 @@ .grid-cols-\[repeat\(auto-fill\,minmax\(25\%\,1fr\)\)\] { grid-template-columns: repeat(auto-fill,minmax(25%,1fr)); } - .grid-cols-\[repeat\(auto-fill\,minmax\(250px\,1fr\)\)\] { - grid-template-columns: repeat(auto-fill,minmax(250px,1fr)); - } .grid-cols-\[repeat\(auto-fill\,minmax\(25vw\,1fr\)\)\] { grid-template-columns: repeat(auto-fill,minmax(25vw,1fr)); } @@ -683,12 +680,18 @@ .grid-cols-\[repeat\(auto-fill\,minmax\(50vw\,1fr\)\)\] { grid-template-columns: repeat(auto-fill,minmax(50vw,1fr)); } + .grid-cols-\[repeat\(auto-fill\,minmax\(250px\,1fr\)\)\] { + grid-template-columns: repeat(auto-fill,minmax(250px,1fr)); + } .flex-col { flex-direction: column; } .items-center { align-items: center; } + .justify-around { + justify-content: space-around; + } .justify-between { justify-content: space-between; } @@ -698,6 +701,9 @@ .gap-4 { gap: calc(var(--spacing) * 4); } + .gap-6 { + gap: calc(var(--spacing) * 6); + } .overflow-hidden { overflow: hidden; } @@ -736,6 +742,9 @@ .object-cover { object-fit: cover; } + .p-2 { + padding: calc(var(--spacing) * 2); + } .p-4 { padding: calc(var(--spacing) * 4); } @@ -752,16 +761,27 @@ font-size: var(--text-4xl); line-height: var(--tw-leading, var(--text-4xl--line-height)); } + .text-lg { + font-size: var(--text-lg); + line-height: var(--tw-leading, var(--text-lg--line-height)); + } .text-xl { font-size: var(--text-xl); line-height: var(--tw-leading, var(--text-xl--line-height)); } + .font-bold { + --tw-font-weight: var(--font-weight-bold); + font-weight: var(--font-weight-bold); + } .text-\[\#140606\] { color: #140606; } .text-\[\#f9ebeb\] { color: #f9ebeb; } + .text-orange-500 { + color: var(--color-orange-500); + } .text-white { color: var(--color-white); } @@ -830,6 +850,17 @@ padding-inline: calc(var(--spacing) * 8); } } + .md\:block { + @media (width >= 48rem) { + display: block; + } + } + .md\:text-lg { + @media (width >= 48rem) { + font-size: var(--text-lg); + line-height: var(--tw-leading, var(--text-lg--line-height)); + } + } .lg\:text-xl { @media (width >= 64rem) { font-size: var(--text-xl); @@ -946,6 +977,10 @@ inherits: false; initial-value: solid; } +@property --tw-font-weight { + syntax: "*"; + inherits: false; +} @property --tw-outline-style { syntax: "*"; inherits: false; diff --git a/src/static/utils.js b/src/static/utils.js index 30bf546..8e5279e 100644 --- a/src/static/utils.js +++ b/src/static/utils.js @@ -40,16 +40,16 @@ function setImagesPerPage(count) { localStorage.setItem("ImagesPP", count); } function getImagesPerPage() { - const count = localStorage.getItem("ImagesPP"); + let count = localStorage.getItem("ImagesPP"); const url = new URL(window.location.toString()); const countParam = url.searchParams.get("ImagesPP"); if (!count && !countParam) { setImagesPerPage(24); url.searchParams.set("ImagesPP", 24); - return Number(24); + count = Number(24); } else if (countParam) { - return Number(countParam); + count = Number(countParam); } else if (count) { url.searchParams.set("ImagesPP", count); window.history.pushState( @@ -57,10 +57,20 @@ function getImagesPerPage() { `Wah-Collection/Images`, `?${url.searchParams.toString()}` ); - return Number(count); + count = Number(count); } else { - return 24; + count = 24; } + + const active = document.querySelectorAll(`[data-ipp="${count}"]`); + if (active.length > 0) { + active.forEach((item) => { + item.classList.add("underline"); + item.classList.add("text-orange-500"); + item.classList.add("font-bold"); + }); + } + return count; } function setOffset(offset) { @@ -79,23 +89,32 @@ function getOffset() { } function enableNav() { - function handleClickPrev() { - setOffset(getOffset() - getImagesPerPage()) + setOffset(getOffset() - getImagesPerPage()); } function handleClickNext() { - setOffset(getOffset() + getImagesPerPage()) + setOffset(getOffset() + getImagesPerPage()); } - const nav_prev = document.querySelectorAll("#nav_prev") - const nav_next = document.querySelectorAll("#nav_next") + function handleClickIpp(ipp) { + setImagesPerPage(ipp); + const url = new URL(window.location.toString()); + url.searchParams.set("ImagesPP", ipp); + window.location.href = url.href; + } + + const nav_prev = document.querySelectorAll("#nav_prev"); + const nav_next = document.querySelectorAll("#nav_next"); + const nav_ipp = document.querySelectorAll("#nav_ipp"); nav_prev.forEach((item) => { - item.addEventListener('click', handleClickPrev) - }) + item.addEventListener("click", handleClickPrev); + }); nav_next.forEach((item) => { - item.addEventListener('click', handleClickNext) - }) - -} \ No newline at end of file + item.addEventListener("click", handleClickNext); + }); + nav_ipp.forEach((item) => { + item.addEventListener("click", () => handleClickIpp(item.dataset.ipp)); + }); +} diff --git a/src/templates/Components/PageNavigation.tsx b/src/templates/Components/PageNavigation.tsx index f2d2351..9797322 100644 --- a/src/templates/Components/PageNavigation.tsx +++ b/src/templates/Components/PageNavigation.tsx @@ -1,10 +1,22 @@ export default function PageNav() { + + const ipp = [12,24,32,48,72,100,250,500,1000] + return ( -
- - + })} +
+