20 lines
539 B
TypeScript
20 lines
539 B
TypeScript
import { computed, ref } from "vue";
|
|
|
|
const previewedUiFontFamily = ref<string | null>(null);
|
|
|
|
export function useUiFontFamilyPreview() {
|
|
const uiFontFamilyPreview = computed(() => previewedUiFontFamily.value);
|
|
|
|
function previewUiFontFamily(fontFamily: string) {
|
|
const next = fontFamily.trim();
|
|
if (!next) return;
|
|
previewedUiFontFamily.value = next;
|
|
}
|
|
|
|
function clearUiFontFamilyPreview() {
|
|
previewedUiFontFamily.value = null;
|
|
}
|
|
|
|
return { uiFontFamilyPreview, previewUiFontFamily, clearUiFontFamilyPreview };
|
|
}
|