mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-20 15:19:16 +00:00
27 lines
743 B
TypeScript
27 lines
743 B
TypeScript
export interface NoteFontOption {
|
|
id: string;
|
|
family: string;
|
|
}
|
|
|
|
export const resolveNoteFontFamily = (
|
|
fonts: NoteFontOption[],
|
|
storedValue: string,
|
|
): string => {
|
|
if (!storedValue) return "";
|
|
return fonts.find((font) => font.family === storedValue)?.family
|
|
?? fonts.find((font) => font.id === storedValue)?.family
|
|
?? "";
|
|
};
|
|
|
|
export const resolveNoteFontSelectionId = (
|
|
fonts: NoteFontOption[],
|
|
storedValue: string,
|
|
): string => fonts.find((font) => font.family === storedValue)?.id
|
|
?? fonts.find((font) => font.id === storedValue)?.id
|
|
?? "";
|
|
|
|
export const resolveNoteFontSelectionFamily = (
|
|
fonts: NoteFontOption[],
|
|
selectedId: string,
|
|
): string => fonts.find((font) => font.id === selectedId)?.family ?? "";
|