Skip to content

Commit 933bc7c

Browse files
authored
Merge pull request #225 from javaevolved/brunoborges-fix-toggle-button-width
Keep show-all button width stable
2 parents 4d8b263 + bee67c0 commit 933bc7c

3 files changed

Lines changed: 22 additions & 2 deletions

File tree

site/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@
229229

230230
const updateShowAllButton = () => {
231231
if (!showAllButton) return;
232-
showAllButton.textContent = showingAll
232+
showAllButton.querySelector('.show-all-btn-text').textContent = showingAll
233233
? showAllButton.dataset.hideLabel
234234
: showAllButton.dataset.showLabel;
235235
};

site/styles.css

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,7 @@ nav {
497497
}
498498

499499
.show-all-btn {
500+
display: grid;
500501
padding: 10px 20px;
501502
color: var(--text);
502503
font: inherit;
@@ -509,6 +510,25 @@ nav {
509510
transition: all 0.25s;
510511
}
511512

513+
.show-all-btn::before,
514+
.show-all-btn::after,
515+
.show-all-btn-text {
516+
grid-area: 1 / 1;
517+
}
518+
519+
.show-all-btn::before,
520+
.show-all-btn::after {
521+
visibility: hidden;
522+
}
523+
524+
.show-all-btn::before {
525+
content: attr(data-show-label);
526+
}
527+
528+
.show-all-btn::after {
529+
content: attr(data-hide-label);
530+
}
531+
512532
.show-all-btn:hover {
513533
transform: translateY(-2px);
514534
background: var(--surface-2);

templates/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ <h2 class="section-title">{{site.allComparisons}}</h2>
300300
</div>
301301
<button class="show-all-btn" id="showAllButton" type="button"
302302
data-show-label="{{filters.showAll}}" data-hide-label="{{filters.hideAll}}">
303-
{{filters.showAll}}
303+
<span class="show-all-btn-text">{{filters.showAll}}</span>
304304
</button>
305305
<button class="view-toggle-btn" id="viewToggle" aria-label="Toggle view mode">
306306
<span class="view-toggle-icon"></span>

0 commit comments

Comments
 (0)