UNPKG

@eccenca/gui-elements

Version:

GUI elements based on other libraries, usable in React application, written in Typescript.

29 lines 1.24 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Skeleton = Skeleton; const react_1 = __importDefault(require("react")); const classnames_1 = require("./classnames"); /** * `<Skeleton />` provides a loading state display of its children elements. * It does not provide its own content. */ function Skeleton({ children }) { const alteredChildren = react_1.default.Children.map(children, (child) => { const originalChild = child; if (originalChild.props) { return react_1.default.cloneElement(originalChild, { className: originalChild.props.className ? originalChild.props.className + " " + classnames_1.SKELETON : classnames_1.SKELETON, // @see https://blueprintjs.com/docs/versions/4/#core/components/skeleton disabled: true, tabIndex: -1, }); } return originalChild; }); return react_1.default.createElement(react_1.default.Fragment, null, alteredChildren); } exports.default = Skeleton; //# sourceMappingURL=Skeleton.js.map