DocSpace-client/packages/common/components/Loaders/TileLoader/TileLoader.js

141 lines
3.8 KiB
JavaScript
Raw Normal View History

import React from "react";
import PropTypes from "prop-types";
import {
StyledTile,
StyledBottom,
StyledMainContent,
} from "./StyledTileLoader";
2023-11-10 07:20:02 +00:00
import RectangleSkeleton from "@docspace/components/skeletons/rectangle";
const TileLoader = ({
isFolder,
title,
borderRadius,
backgroundColor,
foregroundColor,
backgroundOpacity,
foregroundOpacity,
speed,
animate,
...rest
}) => {
return isFolder ? (
<StyledTile {...rest} isFolder>
<StyledBottom className="bottom-content" isFolder>
2023-11-10 07:20:02 +00:00
<RectangleSkeleton
className="first-content"
title={title}
width="100%"
borderRadius={borderRadius}
backgroundColor={backgroundColor}
foregroundColor={foregroundColor}
backgroundOpacity={backgroundOpacity}
foregroundOpacity={foregroundOpacity}
speed={speed}
2021-12-21 15:00:54 +00:00
animate={true}
/>
2023-11-10 07:20:02 +00:00
<RectangleSkeleton
className="second-content"
title={title}
height="22px"
borderRadius={borderRadius}
backgroundColor={backgroundColor}
foregroundColor={foregroundColor}
backgroundOpacity={backgroundOpacity}
foregroundOpacity={foregroundOpacity}
speed={speed}
2021-12-21 15:00:54 +00:00
animate={true}
/>
2023-11-10 07:20:02 +00:00
<RectangleSkeleton
2021-12-21 15:00:54 +00:00
className="option-button"
title={title}
height="16px"
width="16px"
2021-12-21 15:00:54 +00:00
borderRadius={borderRadius}
backgroundColor={backgroundColor}
foregroundColor={foregroundColor}
backgroundOpacity={backgroundOpacity}
foregroundOpacity={foregroundOpacity}
speed={speed}
animate={true}
/>
</StyledBottom>
</StyledTile>
) : (
<StyledTile {...rest}>
<StyledMainContent>
2023-11-10 07:20:02 +00:00
<RectangleSkeleton
className="main-content"
title={title}
height="156px"
borderRadius={borderRadius ? borderRadius : "0"}
backgroundColor={backgroundColor}
foregroundColor={foregroundColor}
backgroundOpacity={backgroundOpacity}
foregroundOpacity={foregroundOpacity}
speed={speed}
2021-12-21 15:00:54 +00:00
animate={true}
/>
</StyledMainContent>
<StyledBottom className="bottom-content">
2023-11-10 07:20:02 +00:00
<RectangleSkeleton
className="first-content"
title={title}
width="100%"
borderRadius={borderRadius}
backgroundColor={backgroundColor}
foregroundColor={foregroundColor}
backgroundOpacity={backgroundOpacity}
foregroundOpacity={foregroundOpacity}
speed={speed}
animate={true}
/>
2023-11-10 07:20:02 +00:00
<RectangleSkeleton
className="second-content"
title={title}
height="22px"
borderRadius={borderRadius}
backgroundColor={backgroundColor}
foregroundColor={foregroundColor}
backgroundOpacity={backgroundOpacity}
foregroundOpacity={foregroundOpacity}
speed={speed}
animate={true}
/>
2023-11-10 07:20:02 +00:00
<RectangleSkeleton
className="option-button"
title={title}
height="16px"
width="16px"
borderRadius={borderRadius}
backgroundColor={backgroundColor}
foregroundColor={foregroundColor}
backgroundOpacity={backgroundOpacity}
foregroundOpacity={foregroundOpacity}
speed={speed}
2021-12-21 15:00:54 +00:00
animate={true}
/>
</StyledBottom>
</StyledTile>
);
};
TileLoader.propTypes = {
id: PropTypes.string,
className: PropTypes.string,
style: PropTypes.object,
isRectangle: PropTypes.bool,
isFolder: PropTypes.bool,
};
TileLoader.defaultProps = {
id: undefined,
className: undefined,
style: undefined,
isRectangle: true,
isFolder: false,
};
export default TileLoader;