Skip to content

Commit 8bbeea6

Browse files
committed
site: improve mobile design
1 parent 6785176 commit 8bbeea6

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

‎site/site.js‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,25 @@ systemTheme.addEventListener('change', event => {
102102
if (!themeOverride) applyTheme(event.matches ? 'dark' : 'light');
103103
});
104104

105+
const featurePalette = document.querySelector('.feature-palette');
106+
let themeFadeFrame = 0;
107+
108+
function updateThemeToggleVisibility() {
109+
themeFadeFrame = 0;
110+
const distance = featurePalette.getBoundingClientRect().top;
111+
const opacity = Math.max(0, Math.min(1, (distance - 64) / 240));
112+
themeToggle.style.opacity = opacity;
113+
themeToggle.inert = opacity === 0;
114+
}
115+
116+
function queueThemeToggleVisibility() {
117+
if (!themeFadeFrame) themeFadeFrame = requestAnimationFrame(updateThemeToggleVisibility);
118+
}
119+
120+
window.addEventListener('scroll', queueThemeToggleVisibility, {passive: true});
121+
window.addEventListener('resize', queueThemeToggleVisibility);
122+
updateThemeToggleVisibility();
123+
105124
const latestZipCacheKey = 'commando-site-latest-zip';
106125
const latestZipCacheAge = 60 * 60 * 1000;
107126

‎site/style.css‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,3 +239,13 @@ kbd { display: inline-flex; align-items: center; justify-content: center; min-wi
239239
.keys { flex-wrap: wrap; }
240240
}
241241
}
242+
243+
@media (max-width: 500px) {
244+
.overview, .movie, .feature-palette {
245+
width: calc(100% + 48px);
246+
margin-inline: -24px;
247+
border-radius: 0;
248+
}
249+
250+
.palette-header, .search-bar { border-radius: 0; }
251+
}

0 commit comments

Comments
 (0)