mirror of
https://github.com/DefectingCat/DefectingCat.github.io
synced 2025-07-15 08:41:37 +00:00
add gist skeleton loading
This commit is contained in:
@ -1,4 +1,5 @@
|
|||||||
.next
|
.next
|
||||||
out
|
out
|
||||||
node_modules
|
node_modules
|
||||||
.devcontainer
|
.devcontainer
|
||||||
|
build
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import GistsCode from 'app/gists/gists-code';
|
import GistsCode from 'app/gists/gists-code';
|
||||||
|
import clsx from 'clsx';
|
||||||
import LinkAnchor from 'components/mdx/link-anchor';
|
import LinkAnchor from 'components/mdx/link-anchor';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import relativeTime from 'dayjs/plugin/relativeTime';
|
import relativeTime from 'dayjs/plugin/relativeTime';
|
||||||
@ -7,6 +8,7 @@ import Image from 'next/image';
|
|||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import { notFound } from 'next/navigation';
|
import { notFound } from 'next/navigation';
|
||||||
import avatar from 'public/images/img/avatar.svg';
|
import avatar from 'public/images/img/avatar.svg';
|
||||||
|
import GistsCodeSkeleton from 'app/gists/gists-code-skeleton';
|
||||||
|
|
||||||
export const revalidate = 600;
|
export const revalidate = 600;
|
||||||
|
|
||||||
@ -25,42 +27,38 @@ export default async function Page({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<main className="max-w-5xl px-4 mx-auto lg:px-0">
|
<div className="flex items-center py-1 ">
|
||||||
<div className="pb-4 text-sm">
|
<Image
|
||||||
<div className="flex items-center py-1 ">
|
src={avatar}
|
||||||
<Image
|
alt="Avatar"
|
||||||
src={avatar}
|
priority
|
||||||
alt="Avatar"
|
width={32}
|
||||||
priority
|
height={32}
|
||||||
width={32}
|
className="rounded-full "
|
||||||
height={32}
|
/>
|
||||||
className="rounded-full "
|
<h1 className="ml-2 overflow-hidden text-xl whitespace-nowrap overflow-ellipsis">
|
||||||
/>
|
<Link href="/gists">
|
||||||
<h1 className="ml-2 overflow-hidden text-xl whitespace-nowrap overflow-ellipsis">
|
<LinkAnchor external={false}>{gist.login}</LinkAnchor>
|
||||||
<Link href="/gists">
|
</Link>
|
||||||
<LinkAnchor external={false}>{gist.login}</LinkAnchor>
|
/{Object.keys(gist.files)[0]}
|
||||||
</Link>
|
</h1>
|
||||||
/{Object.keys(gist.files)[0]}
|
</div>
|
||||||
</h1>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p className="pl-10 text-gray-400 ">
|
<p className="pl-10 text-gray-400 ">
|
||||||
Last active: {dayjs(gist.updated_at).fromNow()}
|
Last active: {dayjs(gist.updated_at).fromNow()}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div className="py-4">
|
<div className="py-4">
|
||||||
<p className="pb-2 text-lg text-gray-500">{gist.description}</p>
|
<p className="pb-2 text-lg text-gray-500">{gist.description}</p>
|
||||||
|
|
||||||
{Object.keys(gist.files).map((f) => (
|
{Object.keys(gist.files).map((f) => (
|
||||||
<GistsCode
|
<GistsCode
|
||||||
key={gist.files[f].raw_url}
|
key={gist.files[f].raw_url}
|
||||||
file={gist.files[f]}
|
file={gist.files[f]}
|
||||||
showFileName
|
showFileName
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -7,5 +7,11 @@ export default async function PageLayout({
|
|||||||
}: {
|
}: {
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
}) {
|
}) {
|
||||||
return <>{children}</>;
|
return (
|
||||||
|
<>
|
||||||
|
<main className="max-w-5xl px-4 mx-auto lg:px-0">
|
||||||
|
<div className="pb-4 text-sm">{children}</div>
|
||||||
|
</main>
|
||||||
|
</>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,56 @@
|
|||||||
|
import GistsCodeSkeleton from 'app/gists/gists-code-skeleton';
|
||||||
|
import clsx from 'clsx';
|
||||||
|
|
||||||
const loading = () => {
|
const loading = () => {
|
||||||
return <>loading</>;
|
return (
|
||||||
|
<>
|
||||||
|
<div className="flex items-center py-1 ">
|
||||||
|
<div
|
||||||
|
className={clsx(
|
||||||
|
'w-8 h-8 rounded-full',
|
||||||
|
'bg-gray-200 animate-pulse dark:bg-rua-gray-600',
|
||||||
|
)}
|
||||||
|
></div>
|
||||||
|
<h1
|
||||||
|
className={clsx(
|
||||||
|
'ml-2 overflow-hidden text-xl',
|
||||||
|
'whitespace-nowrap overflow-ellipsis',
|
||||||
|
'flex items-center',
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className={clsx(
|
||||||
|
'w-32 h-5 bg-gray-200',
|
||||||
|
'animate-pulse rounded-md',
|
||||||
|
'dark:bg-rua-gray-600',
|
||||||
|
)}
|
||||||
|
></div>
|
||||||
|
<span className="mx-1">/</span>
|
||||||
|
<div
|
||||||
|
className={clsx(
|
||||||
|
'w-32 h-5 bg-gray-200',
|
||||||
|
'animate-pulse rounded-md',
|
||||||
|
'dark:bg-rua-gray-600',
|
||||||
|
)}
|
||||||
|
></div>
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p className="text-gray-400 pl-11 ">
|
||||||
|
<div
|
||||||
|
className={clsx(
|
||||||
|
'w-32 h-4 bg-gray-200',
|
||||||
|
'animate-pulse rounded-md',
|
||||||
|
'dark:bg-rua-gray-600',
|
||||||
|
)}
|
||||||
|
></div>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div className="py-4">
|
||||||
|
<GistsCodeSkeleton />
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default loading;
|
export default loading;
|
||||||
|
@ -6,6 +6,7 @@ const bodyClass = clsx(
|
|||||||
'rounded-lg',
|
'rounded-lg',
|
||||||
'h-4 bg-gray-300',
|
'h-4 bg-gray-300',
|
||||||
'mb-2 last:mb-0 animate-pulse',
|
'mb-2 last:mb-0 animate-pulse',
|
||||||
|
'dark:bg-rua-gray-600',
|
||||||
);
|
);
|
||||||
const allLength = [
|
const allLength = [
|
||||||
500, 400, 300, 200, 332, 402, 105, 399, 501, 285, 378, 123, 325, 456,
|
500, 400, 300, 200, 332, 402, 105, 399, 501, 285, 378, 123, 325, 456,
|
||||||
@ -53,6 +54,7 @@ const GistsCode = () => {
|
|||||||
className={clsx(
|
className={clsx(
|
||||||
'bg-gray-300 animate-pulse',
|
'bg-gray-300 animate-pulse',
|
||||||
'w-20 h-4 block rounded',
|
'w-20 h-4 block rounded',
|
||||||
|
'dark:bg-rua-gray-600',
|
||||||
)}
|
)}
|
||||||
></span>
|
></span>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user