Isolate common stylesheets

This commit is contained in:
Federico Bologni 2023-06-30 17:19:45 +02:00
parent 50b6e0104b
commit 00fc29c6ad
3 changed files with 9 additions and 8 deletions

View file

@ -13,6 +13,12 @@ const app = {
link: {
icon: appIconURL,
},
styleSheets: [robotoFontStyle, appStyle]
.map((rawSheet) => {
const sheet = new CSSStyleSheet();
sheet.replaceSync(rawSheet);
return sheet;
}),
page: null,
router: new Router(),
loader: WDLoader.instance,
@ -23,12 +29,7 @@ const app = {
<meta name="viewport" content="${app.meta.viewport}">
`;
document.title = app.title;
document.adoptedStyleSheets = [robotoFontStyle, appStyle]
.map((rawSheet) => {
const sheet = new CSSStyleSheet();
sheet.replaceSync(rawSheet);
return sheet;
});
document.adoptedStyleSheets = app.styleSheets;
},
};

View file

@ -26,7 +26,7 @@ class HomePage {
#addPageStyle() {
const sheet = new CSSStyleSheet();
sheet.replaceSync(pageStyle);
document.adoptedStyleSheets = [...document.adoptedStyleSheets, sheet];
document.adoptedStyleSheets = [...app.styleSheets, sheet];
}
/**

View file

@ -26,7 +26,7 @@ class RoutesPage {
#addPageStyle() {
const sheet = new CSSStyleSheet();
sheet.replaceSync(pageStyle);
document.adoptedStyleSheets = [...document.adoptedStyleSheets, sheet];
document.adoptedStyleSheets = [...app.styleSheets, sheet];
}
/**