From 98769644526a5798682680db6345943114da9d7a Mon Sep 17 00:00:00 2001
From: DefectingCat
Date: Mon, 14 Aug 2023 14:28:05 +0800
Subject: [PATCH] add gist skeleton loading
---
.dockerignore | 3 +-
app/g/[id]/page.tsx | 64 +++++++++++++++----------------
app/g/layout.tsx | 8 +++-
app/g/loading.tsx | 53 ++++++++++++++++++++++++-
app/gists/gists-code-skeleton.tsx | 2 +
5 files changed, 94 insertions(+), 36 deletions(-)
diff --git a/.dockerignore b/.dockerignore
index 800efcf..a446f13 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,4 +1,5 @@
.next
out
node_modules
-.devcontainer
\ No newline at end of file
+.devcontainer
+build
diff --git a/app/g/[id]/page.tsx b/app/g/[id]/page.tsx
index 6e6ce9c..a416525 100644
--- a/app/g/[id]/page.tsx
+++ b/app/g/[id]/page.tsx
@@ -1,4 +1,5 @@
import GistsCode from 'app/gists/gists-code';
+import clsx from 'clsx';
import LinkAnchor from 'components/mdx/link-anchor';
import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
@@ -7,6 +8,7 @@ import Image from 'next/image';
import Link from 'next/link';
import { notFound } from 'next/navigation';
import avatar from 'public/images/img/avatar.svg';
+import GistsCodeSkeleton from 'app/gists/gists-code-skeleton';
export const revalidate = 600;
@@ -25,42 +27,38 @@ export default async function Page({
return (
<>
-
-
-
-
-
-
- {gist.login}
-
- /{Object.keys(gist.files)[0]}
-
-
+
+
+
+
+ {gist.login}
+
+ /{Object.keys(gist.files)[0]}
+
+
-
- Last active: {dayjs(gist.updated_at).fromNow()}
-
+
+ Last active: {dayjs(gist.updated_at).fromNow()}
+
-
-
{gist.description}
+
+
{gist.description}
- {Object.keys(gist.files).map((f) => (
-
- ))}
-
-
-
+ {Object.keys(gist.files).map((f) => (
+
+ ))}
+
>
);
}
diff --git a/app/g/layout.tsx b/app/g/layout.tsx
index ffede56..360cfb6 100644
--- a/app/g/layout.tsx
+++ b/app/g/layout.tsx
@@ -7,5 +7,11 @@ export default async function PageLayout({
}: {
children: ReactNode;
}) {
- return <>{children}>;
+ return (
+ <>
+
+ {children}
+
+ >
+ );
}
diff --git a/app/g/loading.tsx b/app/g/loading.tsx
index e6851ac..9f14e63 100644
--- a/app/g/loading.tsx
+++ b/app/g/loading.tsx
@@ -1,5 +1,56 @@
+import GistsCodeSkeleton from 'app/gists/gists-code-skeleton';
+import clsx from 'clsx';
+
const loading = () => {
- return <>loading>;
+ return (
+ <>
+
+
+
+
+
+
+
+
+
+ >
+ );
};
export default loading;
diff --git a/app/gists/gists-code-skeleton.tsx b/app/gists/gists-code-skeleton.tsx
index bdaa220..ed9b359 100644
--- a/app/gists/gists-code-skeleton.tsx
+++ b/app/gists/gists-code-skeleton.tsx
@@ -6,6 +6,7 @@ const bodyClass = clsx(
'rounded-lg',
'h-4 bg-gray-300',
'mb-2 last:mb-0 animate-pulse',
+ 'dark:bg-rua-gray-600',
);
const allLength = [
500, 400, 300, 200, 332, 402, 105, 399, 501, 285, 378, 123, 325, 456,
@@ -53,6 +54,7 @@ const GistsCode = () => {
className={clsx(
'bg-gray-300 animate-pulse',
'w-20 h-4 block rounded',
+ 'dark:bg-rua-gray-600',
)}
>