new ui font
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
import type {CookieRef} from "#app";
|
||||
|
||||
export function ui_color_cookie(): CookieRef<string> {
|
||||
|
||||
const c = useCookie("ui_color",{
|
||||
default: () => "green",
|
||||
|
||||
});
|
||||
watch(c, (newVal, oldVal) => {
|
||||
// remove old class (if it's been put)
|
||||
if (oldVal != undefined) document.body.classList.remove("ui-" + oldVal);
|
||||
|
||||
// add new class
|
||||
document.body.classList.add("ui-" + newVal);
|
||||
}, { immediate: true})
|
||||
|
||||
return c;
|
||||
|
||||
}
|
||||
22
app/composables/ui_cookies.ts
Normal file
22
app/composables/ui_cookies.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import type {CookieRef} from "#app";
|
||||
|
||||
function ui_cookie(name:string, def:string,prefix:string): CookieRef<string> {
|
||||
|
||||
const c = useCookie(name,{
|
||||
default: () => def,
|
||||
|
||||
});
|
||||
watch(c, (newVal, oldVal) => {
|
||||
// remove old class (if it's been put)
|
||||
if (oldVal != undefined) document.body.classList.remove(prefix + oldVal.toLowerCase());
|
||||
|
||||
// add new class
|
||||
document.body.classList.add(prefix + newVal.toLowerCase());
|
||||
}, { immediate: true})
|
||||
|
||||
return c;
|
||||
|
||||
}
|
||||
|
||||
export function ui_color_cookie() { return ui_cookie("ui_color","green","ui-"); }
|
||||
export function ui_font_cookie() { return ui_cookie("ui_font","pubsans","font-"); }
|
||||
Reference in New Issue
Block a user