From 8ba5bfb5e3ce2b7f398f1893efde4bd92fcb6015 Mon Sep 17 00:00:00 2001
From: crupest <crupest@outlook.com>
Date: Sun, 14 Feb 2021 17:14:52 +0800
Subject: feat: Add skeleton for text post.

---
 FrontEnd/src/app/views/common/Skeleton.tsx | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 FrontEnd/src/app/views/common/Skeleton.tsx

(limited to 'FrontEnd/src/app/views/common/Skeleton.tsx')

diff --git a/FrontEnd/src/app/views/common/Skeleton.tsx b/FrontEnd/src/app/views/common/Skeleton.tsx
new file mode 100644
index 00000000..6340f96f
--- /dev/null
+++ b/FrontEnd/src/app/views/common/Skeleton.tsx
@@ -0,0 +1,24 @@
+import React from "react";
+import clsx from "clsx";
+import { range } from "lodash";
+
+export interface SkeletonProps {
+  lineNumber?: number;
+  className?: string;
+  style?: React.CSSProperties;
+}
+
+const Skeleton: React.FC<SkeletonProps> = (props) => {
+  const { lineNumber: lineNumberProps, className, style } = props;
+  const lineNumber = lineNumberProps ?? 3;
+
+  return (
+    <div className={clsx(className, "cru-skeleton")} style={style}>
+      {range(lineNumber).map((i) => (
+        <div key={i} className="cru-skeleton-line" />
+      ))}
+    </div>
+  );
+};
+
+export default Skeleton;
-- 
cgit v1.2.3

