to remove temp version and header color, squash (#674)

This commit is contained in:
Will Bjorn 2024-09-17 13:48:26 -07:00 коммит произвёл GitHub
Родитель dbdea10ff1
Коммит 1441c85d1c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
4 изменённых файлов: 42 добавлений и 16 удалений

Просмотреть файл

@ -0,0 +1,5 @@
---
'@microsoft/atlas-site': minor
---
Update doc site to use a view transition when changing between layout examples.

Просмотреть файл

@ -0,0 +1,5 @@
---
'@microsoft/atlas-css': patch
---
Refactor all layouts to use minmax(0 Xfr), where prior they were Xfr.

Просмотреть файл

@ -72,7 +72,7 @@ $three-quarters-widescreen: math.div($breakpoint-widescreen, 4) * 3;
.layout,
.layout.layout-single {
.layout-body {
grid-template: auto auto auto 1fr auto auto / 1fr;
grid-template: auto auto auto 1fr auto auto / minmax(0, 1fr);
grid-template-areas: 'header' 'hero' 'menu' 'main' 'aside' 'footer';
}
}
@ -83,7 +83,7 @@ $three-quarters-widescreen: math.div($breakpoint-widescreen, 4) * 3;
grid-template-areas: 'header' 'hero' 'menu' 'main' 'aside' 'footer';
@include tablet {
grid-template: auto auto 1fr auto auto / 1fr 2fr;
grid-template: auto auto 1fr auto auto / minmax(0, 1fr) minmax(0, 2fr);
grid-template-areas:
'header header'
'hero hero'
@ -93,7 +93,7 @@ $three-quarters-widescreen: math.div($breakpoint-widescreen, 4) * 3;
}
@include desktop {
grid-template: auto auto 1fr auto / 1fr 2fr 1fr;
grid-template: auto auto 1fr auto / minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr);
grid-template-areas:
'header header header'
'hero hero hero'
@ -118,11 +118,11 @@ $three-quarters-widescreen: math.div($breakpoint-widescreen, 4) * 3;
}
.layout-body {
grid-template: auto auto auto 1fr auto / 1fr;
grid-template: auto auto auto 1fr auto / minmax(0, 1fr);
grid-template-areas: 'header' 'hero' 'menu' 'main' 'footer';
@include tablet {
grid-template: auto auto 1fr auto / 1fr 2fr;
grid-template: auto auto 1fr auto / minmax(0, 1fr) minmax(0, 2fr);
grid-template-areas:
'header header'
'hero hero'
@ -131,7 +131,7 @@ $three-quarters-widescreen: math.div($breakpoint-widescreen, 4) * 3;
}
@include desktop {
grid-template: auto auto 1fr auto / 1fr 3fr;
grid-template: auto auto 1fr auto / minmax(0, 1fr) minmax(0, 3fr);
grid-template-areas:
'header header'
'hero hero'
@ -156,11 +156,11 @@ $three-quarters-widescreen: math.div($breakpoint-widescreen, 4) * 3;
}
.layout-body {
grid-template: auto auto auto 1fr auto / 1fr;
grid-template: auto auto auto 1fr auto / minmax(0, 1fr);
grid-template-areas: 'header' 'hero' 'main' 'aside' 'footer';
@include tablet {
grid-template: auto auto 1fr auto / 2fr 1fr;
grid-template: auto auto 1fr auto / minmax(0, 2fr) minmax(0, 1fr);
grid-template-areas:
'header header'
'hero hero'
@ -169,7 +169,7 @@ $three-quarters-widescreen: math.div($breakpoint-widescreen, 4) * 3;
}
@include desktop {
grid-template: auto auto 1fr auto / 3fr 1fr;
grid-template: auto auto 1fr auto / minmax(0, 3fr) minmax(0, 1fr);
grid-template-areas:
'header header'
'hero hero'

Просмотреть файл

@ -26,14 +26,16 @@ export function initLayoutPageControls() {
'Attempting to set a layout class that does not match current list of available layouts'
);
}
setLayoutClass(layoutToSet);
scrollTo({ behavior: 'smooth', top: target.getBoundingClientRect().top - 200 });
const setThemeButtons = Array.from(document.querySelectorAll('[data-set-layout]'));
for (const button of setThemeButtons) {
button.setAttribute('aria-pressed', 'false');
}
target.setAttribute('aria-pressed', 'true');
safeViewTransition(() => {
setLayoutClass(layoutToSet);
scrollTo({ behavior: 'instant', top: target.getBoundingClientRect().top - 200 });
const setThemeButtons = Array.from(document.querySelectorAll('[data-set-layout]'));
for (const button of setThemeButtons) {
button.setAttribute('aria-pressed', 'false');
}
target.setAttribute('aria-pressed', 'true');
});
});
window.addEventListener('click', (e: MouseEvent) => {
@ -47,3 +49,17 @@ export function initLayoutPageControls() {
target.setAttribute('aria-pressed', target.classList.contains('button-filled').toString());
});
}
declare global {
interface Document {
startViewTransition(callback: () => void): void;
}
}
function safeViewTransition(cb: () => void) {
if (!document.startViewTransition) {
cb();
} else {
document.startViewTransition(() => cb());
}
}