ff-webpage/composables/useGlobal.ts

27 lines
924 B
TypeScript
Raw Normal View History

2025-05-10 17:37:58 +02:00
import type BaseFile from "../types/component/baseFile";
import type Footer from "../types/component/global/footer";
import type Navbar from "../types/component/global/navbar";
import type SEO from "../types/component/global/seo";
import type Global from "../types/single/global";
export const useGlobal = () => {
const global = useState<Global | null>("global");
const runtimeConfig = useRuntimeConfig();
const appTitle = runtimeConfig.public.app.title;
const logo = computed<BaseFile | null>(() => global.value?.logo ?? null);
const navbar = computed<Navbar | null>(() => global.value?.navbar ?? null);
const footer = computed<Footer | null>(() => global.value?.footer ?? null);
const seo = computed<SEO | null>(() => global.value?.SEO ?? null);
const title = computed<string>(() => seo.value?.metaTitle ?? appTitle);
return {
logo,
global,
navbar,
footer,
seo,
title,
};
};