refactor: improve structure of src
This commit is contained in:
parent
b74919b75b
commit
c5d4ec1abd
96 changed files with 146 additions and 157 deletions
19
src/ui/fonts.ts
Normal file
19
src/ui/fonts.ts
Normal file
|
@ -0,0 +1,19 @@
|
|||
// SPDX-FileCopyrightText: 2021 Johannes Loher
|
||||
//
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
const basicFonts = ["Wood Stamp"];
|
||||
const variantFonts = ["Lora"];
|
||||
|
||||
export async function preloadFonts(): Promise<FontFace[][]> {
|
||||
const fonts = [
|
||||
...basicFonts.map((font) => `1rem ${font}`),
|
||||
...variantFonts.flatMap((font) => [
|
||||
`1rem ${font}`,
|
||||
`bold 1rem ${font}`,
|
||||
`italic 1rem ${font}`,
|
||||
`bold italic 1rem ${font}`,
|
||||
]),
|
||||
];
|
||||
return Promise.all(fonts.map((font) => document.fonts.load(font)));
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
//
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import logger from "../logger";
|
||||
import { logger } from "../utils/logger";
|
||||
|
||||
function getNotificationFunction(type: "info" | "warn" | "error") {
|
||||
return (message: string, { permanent = false, log = false }: { permanent?: boolean; log?: boolean } = {}): void => {
|
||||
|
@ -17,7 +17,7 @@ function getNotificationFunction(type: "info" | "warn" | "error") {
|
|||
};
|
||||
}
|
||||
|
||||
const notifications = {
|
||||
export const notifications = Object.freeze({
|
||||
info: getNotificationFunction("info"),
|
||||
warn: getNotificationFunction("warn"),
|
||||
error: getNotificationFunction("error"),
|
||||
|
@ -35,6 +35,4 @@ const notifications = {
|
|||
logger.getLoggingFunction(type)(message);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default notifications;
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue