Loader Components (#2616)
Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
1 parent
28b432058a
commit
d61238c832
6 files changed
+65
-22
No files matched your search
@@ -1,3 +1,4 @@
|
||||
export { default as Button } from "./Button";
|
||||
export { default as EmptyScreen } from "./EmptyScreen";
|
||||
export { default as Switch } from "./Switch";
|
||||
export * from "./skeleton";
|
||||
@@ -0,0 +1,34 @@
|
||||
import classNames from "@calcom/lib/classNames";
|
||||
|
||||
type SkeletonBaseProps = {
|
||||
width: string;
|
||||
height: string;
|
||||
className?: string;
|
||||
};
|
||||
|
||||
interface AvatarProps extends SkeletonBaseProps {
|
||||
// Limit this cause we don't use avatars bigger than thi
|
||||
width: "2" | "3" | "4" | "5" | "6" | "8";
|
||||
height: "2" | "3" | "4" | "5" | "6" | "8";
|
||||
}
|
||||
|
||||
interface SkeletonContainer {
|
||||
as?: keyof JSX.IntrinsicElements;
|
||||
}
|
||||
|
||||
const SkeletonAvatar: React.FC<AvatarProps> = ({ width, height }) => {
|
||||
return (
|
||||
<div className={`mt-1 rounded-full bg-gray-200 ltr:mr-2 rtl:ml-2 w-${width} h-${height} ${classNames}`} />
|
||||
);
|
||||
};
|
||||
|
||||
const SkeletonText: React.FC<SkeletonBaseProps> = ({ width, height }) => {
|
||||
return <div className={`rounded-md bg-gray-200 w-${width} h-${height} ${classNames}`} />;
|
||||
};
|
||||
|
||||
const SkeletonContainer: React.FC<SkeletonContainer> = ({ children, as }) => {
|
||||
const Component = as || "div";
|
||||
return <Component className="animate-pulse">{children}</Component>;
|
||||
};
|
||||
|
||||
export { SkeletonAvatar, SkeletonText, SkeletonContainer };
|
||||
Reference in new issue
Block a user