From 6791c26e28b5113796fdf34e29f7affe12ee556e Mon Sep 17 00:00:00 2001 From: crupest Date: Sun, 14 Feb 2021 17:14:52 +0800 Subject: feat: Add skeleton for text post. --- FrontEnd/src/app/views/common/Skeleton.tsx | 24 ++++++++++++++++++++++++ FrontEnd/src/app/views/common/common.sass | 8 ++++++++ 2 files changed, 32 insertions(+) create mode 100644 FrontEnd/src/app/views/common/Skeleton.tsx (limited to 'FrontEnd/src/app/views/common') 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 = (props) => { + const { lineNumber: lineNumberProps, className, style } = props; + const lineNumber = lineNumberProps ?? 3; + + return ( +
+ {range(lineNumber).map((i) => ( +
+ ))} +
+ ); +}; + +export default Skeleton; diff --git a/FrontEnd/src/app/views/common/common.sass b/FrontEnd/src/app/views/common/common.sass index 78e6fd14..0a03d5e9 100644 --- a/FrontEnd/src/app/views/common/common.sass +++ b/FrontEnd/src/app/views/common/common.sass @@ -31,3 +31,11 @@ border-radius: 50% background: white touch-action: none + +.cru-skeleton + padding: 0 2em + +.cru-skeleton-line + height: 1em + background-color: #e6e6e6 + margin: 0.8em 0 \ No newline at end of file -- cgit v1.2.3