UNPKG

@atlaskit/primitives

Version:

Primitives are token-backed low-level building blocks.

45 lines (44 loc) 2.4 kB
/* show.tsx generated by @compiled/babel-plugin v0.36.1 */ "use strict"; var _typeof = require("@babel/runtime/helpers/typeof"); Object.defineProperty(exports, "__esModule", { value: true }); exports.Show = void 0; require("./show.compiled.css"); var React = _interopRequireWildcard(require("react")); var _runtime = require("@compiled/react/runtime"); function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } var styles = { default: "_1e0cglyw", 'above.xs': "_114b19ly", 'above.sm': "_181n19ly", 'above.md': "_dm2519ly", 'above.lg': "_je3o19ly", 'above.xl': "_1uxv19ly", 'below.xs': "_1m0a19ly", 'below.sm': "_suga19ly", 'below.md': "_1mjb19ly", 'below.lg': "_liwc19ly", 'below.xl': "_14wz19ly" }; /** * Shows the content at a given breakpoint. By default, content is hidden. The primary use case is for visual presentation. * Mix `<Show above="md">` with `<Hide above="md">` to achieve content that shifts at a breakpoint. * * Please note: * - This only uses `display: none` and `display: revert` to show/hide, it does not skip rendering of children trees. * - As this is rendered at all times, there is little performance savings here (just that this is not painted). */ var Show = exports.Show = function Show(_ref) { var above = _ref.above, below = _ref.below, children = _ref.children, _ref$as = _ref.as, AsElement = _ref$as === void 0 ? 'div' : _ref$as, xcss = _ref.xcss; return /*#__PURE__*/React.createElement(AsElement, { className: (0, _runtime.ax)([styles.default, above && styles["above.".concat(above)], below && styles["below.".concat(below)], xcss]) }, children); };