@hitachivantara/uikit-react-core
Version:
UI Kit Core React components.
29 lines (28 loc) • 1 kB
JavaScript
import { useClasses } from "./Skeleton.styles.js";
import { useDefaultProps } from "@hitachivantara/uikit-react-utils";
import { jsx } from "react/jsx-runtime";
//#region src/Skeleton/Skeleton.tsx
/**
* The Skeleton component displays a placeholder that mimics the shape and size of loading content.
*/
var HvSkeleton = (props) => {
const { classes: classesProp, className, children, hidden = false, variant = "text", animation = "pulse", backgroundImage, width, height, style, ...others } = useDefaultProps("HvSkeleton", props);
const { classes, cx } = useClasses(classesProp);
if (hidden) return /* @__PURE__ */ jsx("div", {
className: classes.content,
children
});
return /* @__PURE__ */ jsx("div", {
className: cx(classes.root, classes[variant], classes[animation], className),
style: {
width,
height,
...backgroundImage && { background: `center / contain no-repeat url(${backgroundImage})` },
...style
},
...others,
children
});
};
//#endregion
export { HvSkeleton };