aboutsummaryrefslogtreecommitdiff
path: root/users/ryan/modules/simple-bar/simple-bar-source/lib/components/data/data-widget-loader.jsx
blob: 41150241d40a15b8f01df151b7acc1b6bc72733f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import * as Uebersicht from "uebersicht";
import * as Utils from "../../utils";

export { dataWidgetLoaderStyles as styles } from "../../styles/components/data/data-widget-loader";

const { React } = Uebersicht;

/**
 * A memoized React component that renders a data widget loader.
 *
 * @param {Object} props - The properties object.
 * @param {number} [props.width=14] - The width of the loader.
 * @param {number} [props.height=14] - The height of the loader.
 * @param {string} [props.className] - Additional class names for the loader.
 * @param {Object} [props.style] - Additional styles for the loader.
 * @returns {JSX.Element} The rendered data widget loader component.
 */
export const Widget = React.memo(
  ({ width = 14, height = 14, className, style }) => {
    // Generate class names using the Utils.classNames function
    const classes = Utils.classNames("data-widget-loader", "data-widget", {
      [className]: className,
    });

    // Return the JSX for the data widget loader
    return (
      <div className={classes} style={style}>
        <div
          className="data-widget-loader__inner"
          style={{ width, height, flex: `0 0 ${width || height}px` }}
        />
      </div>
    );
  },
);

Widget.displayName = "DataWidgetLoader";