nimiq-vitepress-theme
Version:
Nimiq UI theme for VitePress
29 lines (28 loc) • 865 B
JavaScript
import { useData } from "vitepress";
import { computed } from "vue";
import { useSourceCode } from "./useSourceCode.mjs";
export function useFooter() {
const { theme, frontmatter, page } = useData();
const { editUrl } = useSourceCode();
const pageFooterLeftText = computed(() => {
const fmValue = frontmatter.value.pageFooterLeftText;
if (fmValue === false)
return null;
if (typeof fmValue === "string")
return fmValue;
const themeValue = theme.value.pageFooterLeftText;
if (themeValue === false)
return null;
if (typeof themeValue === "string")
return themeValue;
if (typeof themeValue === "function") {
const result = themeValue({ path: page.value.filePath });
return result || null;
}
return "Suggest changes on this page";
});
return {
pageFooterLeftText,
editUrl
};
}