From 21137e8d11dae51aa138c41b3e94692dfc217f25 Mon Sep 17 00:00:00 2001 From: Mauro Balades Date: Fri, 16 Aug 2024 11:35:58 +0200 Subject: [PATCH] chore: Update ThemePage component to lazy load theme readme --- src/components/theme-page.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/components/theme-page.tsx b/src/components/theme-page.tsx index 153be2e..a5c36f7 100644 --- a/src/components/theme-page.tsx +++ b/src/components/theme-page.tsx @@ -3,16 +3,16 @@ import { Button } from "./ui/button"; import { useEffect, useState } from "react"; import Markdown from "react-markdown"; import '../app/privacy-policy/markdown.css'; -import { ChevronLeft, MoveLeftIcon } from "lucide-react"; +import { ChevronLeft, LoaderCircleIcon, LoaderIcon, LoaderPinwheelIcon, MoveLeftIcon } from "lucide-react"; export default function ThemePage({ theme }: { theme: ZenTheme }) { - const [readme, setReadme] = useState(""); + const [readme, setReadme] = useState(null); useEffect(() => { getThemeMarkdown(theme).then(setReadme); }, []); return ( -
+
{theme.name}

{theme.name}

@@ -40,8 +40,12 @@ export default function ThemePage({ theme }: { theme: ZenTheme }) {

Go back

-
- {`${readme}`} +
+ {readme === null ? ( + + ) : ( + {`${readme}`} + )}