users/ryan/modules/simple-bar/simple-bar-source/lib/components/data/data-widget-loader.jsx

6c2bdcffebb4a0851d0f0288aa8cbe9c443b6860 · 1.2 KB · 37 lines raw

1 import * as Uebersicht from "uebersicht";
2 import * as Utils from "../../utils";
3
4 export { dataWidgetLoaderStyles as styles } from "../../styles/components/data/data-widget-loader";
5
6 const { React } = Uebersicht;
7
8 /**
9 * A memoized React component that renders a data widget loader.
10 *
11 * @param {Object} props - The properties object.
12 * @param {number} [props.width=14] - The width of the loader.
13 * @param {number} [props.height=14] - The height of the loader.
14 * @param {string} [props.className] - Additional class names for the loader.
15 * @param {Object} [props.style] - Additional styles for the loader.
16 * @returns {JSX.Element} The rendered data widget loader component.
17 */
18 export const Widget = React.memo(
19 ({ width = 14, height = 14, className, style }) => {
20 // Generate class names using the Utils.classNames function
21 const classes = Utils.classNames("data-widget-loader", "data-widget", {
22 [className]: className,
23 });
24
25 // Return the JSX for the data widget loader
26 return (
27 <div className={classes} style={style}>
28 <div
29 className="data-widget-loader__inner"
30 style={{ width, height, flex: `0 0 ${width || height}px` }}
31 />
32 </div>
33 );
34 },
35 );
36
37 Widget.displayName = "DataWidgetLoader";