UNPKG

@eccenca/gui-elements

Version:

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

28 lines 1.09 kB
import React from "react"; import classNames from "classnames"; import { CLASSPREFIX as eccgui } from "../../configuration/constants.js"; /** * Sets the viewability of the the contained element regarding media. * Can be used to hide elements, e.g. when the page is printed. */ export var ApplicationViewability = function (_a) { var _b; var children = _a.children, show = _a.show, hide = _a.hide; if (!show && !hide) { return children; } if (show === hide) { // eslint-disable-next-line no-console console.warn("`<ApplicationViewability/>` used with same media type for `hide` and `show`."); return children; } var enhancedClone = React.cloneElement(children, { className: classNames(children.props.className, (_b = {}, _b["".concat(eccgui, "-application__hide--").concat(hide)] = hide, _b["".concat(eccgui, "-application__show--").concat(show)] = show, _b)), }); return enhancedClone; }; export default ApplicationViewability; //# sourceMappingURL=ApplicationViewability.js.map