docs/js #26
@ -39,8 +39,6 @@ export default function Tabs(props: {
|
|||||||
const [tabs, setTabs] = createSignal<TabType[]>([]);
|
const [tabs, setTabs] = createSignal<TabType[]>([]);
|
||||||
|
|
||||||
const addTab = (tab: TabType) => {
|
const addTab = (tab: TabType) => {
|
||||||
console.log("Adding tab", tab);
|
|
||||||
|
|
||||||
setTabs((prevTabs) => {
|
setTabs((prevTabs) => {
|
||||||
// Append to the end of the array and make sure it's unique
|
// Append to the end of the array and make sure it's unique
|
||||||
if (prevTabs.some((t) => t.value === tab.value)) {
|
if (prevTabs.some((t) => t.value === tab.value)) {
|
||||||
@ -113,7 +111,6 @@ Tabs.Item = (props: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
console.log("Mounting tab", props.label);
|
|
||||||
tabsContext.addTab({ label: props.label, value: props.value });
|
tabsContext.addTab({ label: props.label, value: props.value });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -127,10 +127,10 @@ export const navigation: NavigationSection[] = [
|
|||||||
title: "Fonctions et portée",
|
title: "Fonctions et portée",
|
||||||
href: "/docs/javascript/fonctions-et-portee",
|
href: "/docs/javascript/fonctions-et-portee",
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
title: "Le DOM",
|
// title: "Le DOM",
|
||||||
href: "/docs/javascript/dom",
|
// href: "/docs/javascript/dom",
|
||||||
},
|
// },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -7,40 +7,39 @@ import buildTitle from "./buildTitle";
|
|||||||
export type Data = Awaited<ReturnType<typeof data>>;
|
export type Data = Awaited<ReturnType<typeof data>>;
|
||||||
|
|
||||||
export async function data(pageContext: PageContext) {
|
export async function data(pageContext: PageContext) {
|
||||||
const config = useConfig();
|
const config = useConfig();
|
||||||
await docCache.waitingForCache(20000);
|
await docCache.waitingForCache(20000);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
exports: { frontmatter },
|
exports: { frontmatter },
|
||||||
urlParsed,
|
urlParsed,
|
||||||
} = pageContext;
|
} = pageContext;
|
||||||
const isRoot = urlParsed.pathname === "/";
|
const isRoot = urlParsed.pathname === "/";
|
||||||
|
|
||||||
config({
|
config({
|
||||||
title: buildTitle(isRoot ? undefined : frontmatter?.title),
|
title: buildTitle(isRoot ? undefined : frontmatter?.title),
|
||||||
description: frontmatter?.description,
|
description: frontmatter?.description,
|
||||||
});
|
});
|
||||||
|
|
||||||
let cachePathname = urlParsed.pathname.replace(/\/$/, "").replace(/^\//, "");
|
let cachePathname = urlParsed.pathname.replace(/\/$/, "").replace(/^\//, "");
|
||||||
if (cachePathname === "") cachePathname = "index";
|
if (cachePathname === "") cachePathname = "index";
|
||||||
|
|
||||||
const doc = docCache.get(cachePathname);
|
const doc = docCache.get(cachePathname);
|
||||||
console.log(doc);
|
|
||||||
|
|
||||||
if (!doc) {
|
if (!doc) {
|
||||||
console.error(
|
console.error(
|
||||||
`DocCache: No doc found for ${cachePathname}. This is a bug!`,
|
`DocCache: No doc found for ${cachePathname}. This is a bug!`,
|
||||||
"Please report it to the maintainers.",
|
"Please report it to the maintainers.",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
sections: doc?.sections || [],
|
sections: doc?.sections || [],
|
||||||
frontmatter,
|
frontmatter,
|
||||||
docs: docCache.orderByLastEdit({
|
docs: docCache.orderByLastEdit({
|
||||||
limit: 2,
|
limit: 2,
|
||||||
includedBasePaths: ["docs", "certifications"],
|
includedBasePaths: ["docs", "certifications"],
|
||||||
excludedFileNames: [cachePathname, "docs", "certifications"],
|
excludedFileNames: [cachePathname, "docs", "certifications"],
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user