From f5f797eea793aefeb9fb899c632e282ad10ceed4 Mon Sep 17 00:00:00 2001 From: GauthierWebDev Date: Tue, 22 Apr 2025 13:10:56 +0200 Subject: [PATCH] feat: Add functionality to display latest documentation --- app/components/QuickLinks.tsx | 23 +++++++++++++- app/layouts/DocsLayout.tsx | 33 +++++++++++--------- app/layouts/LayoutDefault.tsx | 7 +++-- app/pages/+data.ts | 5 +++ app/partials/LatestDocs.tsx | 31 +++++++++++++++++++ app/services/DocCache.ts | 58 +++++++++++++++++++++++++++++++++-- 6 files changed, 138 insertions(+), 19 deletions(-) create mode 100644 app/partials/LatestDocs.tsx diff --git a/app/components/QuickLinks.tsx b/app/components/QuickLinks.tsx index b2b46e0..0ba1139 100644 --- a/app/components/QuickLinks.tsx +++ b/app/components/QuickLinks.tsx @@ -3,14 +3,21 @@ import type { IconProps } from "./Icon"; import { Icon } from "./Icon"; import { Link } from "./Link"; +import clsx from "clsx"; type QuickLinksProps = { children: JSXElement; + class?: string; }; export default function QuickLinks(props: QuickLinksProps) { return ( -
+
{props.children}
); @@ -20,6 +27,7 @@ type QuickLinkProps = { title: string; description: string; href: string; + lastEdited?: Date; icon: IconProps["icon"]; }; @@ -36,6 +44,19 @@ QuickLinks.QuickLink = (props: QuickLinkProps) => ( + {props.lastEdited && ( +

+ Dernière modification :{" "} + +

+ )} +

{props.description}

diff --git a/app/layouts/DocsLayout.tsx b/app/layouts/DocsLayout.tsx index 1eee27d..c8e44b0 100644 --- a/app/layouts/DocsLayout.tsx +++ b/app/layouts/DocsLayout.tsx @@ -2,6 +2,7 @@ import type { JSXElement } from "solid-js"; import { PrevNextLinks } from "@/components/PrevNextLinks"; import { usePageContext } from "vike-solid/usePageContext"; +import { LatestDocs } from "@/partials/LatestDocs"; import { clientOnly } from "vike-solid/clientOnly"; import { clock } from "solid-heroicons/outline"; import { navigation } from "@/libs/navigation"; @@ -21,21 +22,25 @@ export function DocsLayout(props: DocsLayoutProps) { return ( <> -
-
- - {props.children} -
- -
+
+
+
+ + {props.children} +
+ +
- + +
+ + ); } diff --git a/app/layouts/LayoutDefault.tsx b/app/layouts/LayoutDefault.tsx index 7dbd8d4..19c6858 100755 --- a/app/layouts/LayoutDefault.tsx +++ b/app/layouts/LayoutDefault.tsx @@ -3,8 +3,8 @@ import type { JSXElement } from "solid-js"; import { usePageContext } from "vike-solid/usePageContext"; import { SmoothScroll } from "@/components/SmoothScroll"; import { HeroSection } from "@/partials/HeroSection"; -import { Navigation } from "@/partials/Navigation"; import { clientOnly } from "vike-solid/clientOnly"; +import { Navigation } from "@/partials/Navigation"; import { Header } from "@/partials/Header"; import { Footer } from "@/partials/Footer"; import { DocsLayout } from "./DocsLayout"; @@ -40,7 +40,10 @@ export default function DefaultLayout(props: DefaultLayoutProps) { - {props.children} + +
+ {props.children} +