Skip to content

Commit 72071be

Browse files
committed
Switch gem grid to CSS auto-fill grid, remove row wrappers
1 parent 9100500 commit 72071be

2 files changed

Lines changed: 2 additions & 40 deletions

File tree

assets/css/redesign.css

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,15 +1356,8 @@ ul {
13561356
}
13571357

13581358
.libs-grid__rows {
1359-
display: flex;
1360-
flex-direction: column;
1361-
gap: 1px;
1362-
background: var(--color-border);
1363-
}
1364-
1365-
.libs-row {
13661359
display: grid;
1367-
grid-template-columns: repeat(3, 1fr);
1360+
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
13681361
gap: 1px;
13691362
background: var(--color-border);
13701363
}
@@ -1522,16 +1515,4 @@ ul {
15221515
gap: 12px;
15231516
}
15241517

1525-
.libs-row {
1526-
grid-template-columns: repeat(2, 1fr);
1527-
}
1528-
}
1529-
1530-
/* ------------------------------------------------------------
1531-
Libraries — Responsive ≤480px
1532-
------------------------------------------------------------ */
1533-
@media (max-width: 480px) {
1534-
.libs-row {
1535-
grid-template-columns: 1fr;
1536-
}
15371518
}

libraries/index.html

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,7 @@ <h1 class="page-header__heading">mrbgems</h1>
4949
<section class="libs-grid">
5050
<div class="libs-grid__inner">
5151
<div class="libs-grid__rows" id="libs-grid">
52-
{% assign gems = site.data.mgems %}
53-
{% assign row_size = 3 %}
54-
{% assign row_index = 0 %}
55-
{% for mgem in gems %}
56-
{% assign mod = row_index | modulo: row_size %}
57-
{% if mod == 0 %}<div class="libs-row">{% endif %}
52+
{% for mgem in site.data.mgems %}
5853
{% if mgem.author.first %}{% assign mgem_author = mgem.author | join: ", " %}{% else %}{% assign mgem_author = mgem.author %}{% endif %}
5954
<a
6055
href="{{ mgem.website }}"
@@ -69,9 +64,6 @@ <h1 class="page-header__heading">mrbgems</h1>
6964
</div>
7065
<p class="libs-card__description">{{ mgem.description | xml_escape }}</p>
7166
</a>
72-
{% assign row_index = row_index | plus: 1 %}
73-
{% assign mod_end = row_index | modulo: row_size %}
74-
{% if mod_end == 0 or forloop.last %}</div>{% endif %}
7567
{% endfor %}
7668
</div>
7769
<div class="libs-no-results" id="libs-no-results" aria-live="polite">
@@ -116,17 +108,6 @@ <h1 class="page-header__heading">mrbgems</h1>
116108
}
117109
});
118110

119-
document.querySelectorAll('.libs-row').forEach(function (row) {
120-
var hasVisible = Array.from(row.querySelectorAll('.libs-card')).some(function (c) {
121-
return !c.hasAttribute('hidden');
122-
});
123-
if (hasVisible) {
124-
row.removeAttribute('hidden');
125-
} else {
126-
row.setAttribute('hidden', '');
127-
}
128-
});
129-
130111
if (q) {
131112
countLabel.textContent = 'Showing ' + visible + ' of ' + total + ' libraries';
132113
footerCount.textContent = 'Showing ' + visible + ' of ' + total + ' libraries \u2014';

0 commit comments

Comments
 (0)