mirror of
https://github.com/shoelace-style/webawesome.git
synced 2026-01-19 07:29:14 +00:00
Compare commits
2 Commits
scroller-f
...
docs-updat
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c191709eb1 | ||
|
|
0454f494f5 |
@@ -1,3 +1,11 @@
|
|||||||
|
function debounce(func, wait) {
|
||||||
|
let timeout;
|
||||||
|
return function (...args) {
|
||||||
|
clearTimeout(timeout);
|
||||||
|
timeout = setTimeout(() => func.apply(this, args), wait);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
function updateResults(input) {
|
function updateResults(input) {
|
||||||
const filter = input.value.toLowerCase().trim();
|
const filter = input.value.toLowerCase().trim();
|
||||||
let filtered = Boolean(filter);
|
let filtered = Boolean(filter);
|
||||||
@@ -18,8 +26,10 @@ function updateResults(input) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const debouncedUpdateResults = debounce(updateResults, 300);
|
||||||
|
|
||||||
document.documentElement.addEventListener('input', e => {
|
document.documentElement.addEventListener('input', e => {
|
||||||
if (e.target?.matches('#block-filter wa-input')) {
|
if (e.target?.matches('#block-filter wa-input')) {
|
||||||
updateResults(e.target);
|
debouncedUpdateResults(e.target);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -370,10 +370,22 @@ wa-page > main:has(> .index-grid) {
|
|||||||
|
|
||||||
.index-grid {
|
.index-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(auto-fit, minmax(min(22ch, 100%), 1fr));
|
grid-template-columns: repeat(4, 1fr);
|
||||||
gap: var(--wa-space-2xl);
|
gap: var(--wa-space-2xl);
|
||||||
margin-block-end: var(--wa-space-3xl);
|
margin-block-end: var(--wa-space-3xl);
|
||||||
|
|
||||||
|
@media screen and (max-width: 1470px) {
|
||||||
|
grid-template-columns: repeat(3, 1fr);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 960px) {
|
||||||
|
grid-template-columns: repeat(2, 1fr);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 500px) {
|
||||||
|
grid-template-columns: repeat(1, 1fr);
|
||||||
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
border-radius: var(--wa-border-radius-l);
|
border-radius: var(--wa-border-radius-l);
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
|||||||
Reference in New Issue
Block a user