Skip to content

fix: sort filter dropdown arrow error #2008

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions collections/_pages/catalog.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@
.selected a {
background-color: #222222;
}

.sorting-options {
margin: 0 20px 0 20px;
display: flex;
align-items: center;

@media (max-width: 506px) {
text-align: center;
margin: auto;
}
}

#sort {
padding: 10px;
font-size: 16px;
Expand All @@ -28,10 +31,17 @@
background-repeat: no-repeat;
background-position: right 10px top 50%;
margin-right: 10px;

@media (max-width: 506px) {
display: none;
display: none;
}
}

#sort.no-arrow {
background-image: none;
/* Removes the arrow */
}

#search {
width: 30%;
flex-grow: 1;
Expand All @@ -41,9 +51,11 @@
box-sizing: border-box;
top: 0;
}

.row {
margin: 10px;
}

.column.column-lg.patternCard {
display: block;
}
Expand Down Expand Up @@ -81,6 +93,7 @@ <h2 class="not-found" style="display: none;" id="not-found">
status="{{ pattern.Status }}"
style="display: {{ should_display }};"
>

{% include card.html %}
</div>
{% assign count = count | plus: 1 %}
Expand Down Expand Up @@ -136,6 +149,15 @@ <h2 class="not-found" style="display: none;" id="not-found">

var catalog = Array.from(cards);

var sortElement = this;

// Check if a valid option is selected
if (sortElement.value) {
sortElement.classList.add("no-arrow"); // Add the class to hide the arrow
} else {
sortElement.classList.remove("no-arrow"); // Remove the class to show the arrow
}

if (sortValue === "asc") {
catalog = catalog.sort(function (a, b) {
if (a.getAttribute("status") === "ComingSoon") {
Expand Down Expand Up @@ -205,11 +227,11 @@ <h2 class="not-found" style="display: none;" id="not-found">
// });
// });

document.addEventListener("themeChange",(e)=> {
document.addEventListener("themeChange", (e) => {
// load the snapshot version based on theme
document.querySelectorAll(".pattern-image").forEach(e => {
e.src = event.detail.value == "dark-mode" ? e.dataset.snapshotDark : e.dataset.snapshotLight;
});

})
</script>
</script>