Skeleton component on timeline loading for better user experience (#190)

* the LoadMore component should accept children to have something different than "Loading..."

* skeleton component

* the timeline component now loads with a skeleton

* border radius for skeleton

* dark mode for skeleton
This commit is contained in:
Leonardo Tuna
2023-02-06 16:05:22 -03:00
committed by GitHub
parent cc185674b0
commit 72ab0e25b4
4 changed files with 86 additions and 3 deletions

30
src/Element/Skeleton.tsx Normal file
View File

@ -0,0 +1,30 @@
import "./Skeleton.css";
interface ISkepetonProps {
children?: React.ReactNode;
loading?: boolean;
width?: string;
height?: string;
margin?: string;
}
export default function Skeleton({
children,
width,
height,
margin,
loading = true,
}: ISkepetonProps) {
if (!loading) {
return <>{children}</>;
}
return (
<div
className="skeleton"
style={{ width: width, height: height, margin: margin }}
>
{children}
</div>
);
}