Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added skeleton laoder for code page #593

Merged
merged 1 commit into from
Aug 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions frontend/src/components/CodeSkeleton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

const SkeletonLoader = () => {
return (
<div className="flex justify-center items-center min-h-screen bg-gray-100 dark:bg-gray-900">
<div className="w-[90vw] mt-24 h-[90vh] bg-gray-200 dark:bg-gray-800 p-8 border border-gray-300 dark:border-gray-700 rounded-lg shadow-lg">
<div className="animate-pulse">
<div className="h-4 bg-gray-300 w-1/3 dark:bg-gray-600 mb-4 rounded"></div>
<div className="space-y-4">
<div className="h-4 bg-gray-300 dark:bg-gray-600 rounded w-2/3"></div>
<div className="h-4 bg-gray-300 dark:bg-gray-600 rounded w-3/4"></div>
<div className="h-4 bg-gray-300 dark:bg-gray-600 rounded w-5/6"></div>
<div className="h-4 bg-gray-300 dark:bg-gray-600 rounded w-1/5"></div>
<div className="h-4 bg-gray-300 dark:bg-gray-600 rounded w-3/5"></div>
<div className="h-4 bg-gray-300 dark:bg-gray-600 rounded w-1/3"></div>
<div className="h-4 bg-gray-300 dark:bg-gray-600 rounded w-3/4"></div>
<div className="h-4 bg-gray-300 dark:bg-gray-600 rounded w-5/6"></div>
<div className="h-4 bg-gray-300 dark:bg-gray-600 rounded w-2/3"></div>
<div className="h-4 bg-gray-300 dark:bg-gray-600 rounded w-4/5"></div>
</div>
</div>
</div>
</div>
);
};

export default SkeletonLoader;
4 changes: 2 additions & 2 deletions frontend/src/pages/Post.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useEffect, useState } from "react";
import { Link, useNavigate, useParams } from "react-router-dom";
import axios, { AxiosError } from "axios";
import Loader from "../components/Loader";
import toast from "react-hot-toast";
import Comment from "./Comment";
import { MdFavorite } from "react-icons/md";
Expand All @@ -20,6 +19,7 @@ import { tokenState, userState } from "../store/atoms/auth";
import { useRecoilValue } from "recoil";
import { RiUserFollowFill } from "react-icons/ri";
import { RiUserUnfollowFill } from "react-icons/ri";
import CodeSkeletonLoader from "../components/CodeSkeleton";

const Post = () => {
const { id } = useParams<{ id: string }>();
Expand Down Expand Up @@ -173,7 +173,7 @@ const Post = () => {
};

if (loading) {
return <Loader />;
return <CodeSkeletonLoader />;
}

if (error) {
Expand Down
Loading