@atlaskit/primitives
Version:
Primitives are token-backed low-level building blocks.
43 lines (42 loc) • 2.16 kB
JavaScript
/* hide.tsx generated by @compiled/babel-plugin v0.39.1 */
;
var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Hide = void 0;
require("./hide.compiled.css");
var React = _interopRequireWildcard(require("react"));
var _runtime = require("@compiled/react/runtime");
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
var styles = {
'above.xs': "_114bglyw",
'above.sm': "_181nglyw",
'above.md': "_dm25glyw",
'above.lg': "_je3oglyw",
'above.xl': "_1uxvglyw",
'below.xs': "_1m0aglyw",
'below.sm': "_sugaglyw",
'below.md': "_1mjbglyw",
'below.lg': "_liwcglyw",
'below.xl': "_14wzglyw"
};
/**
* Hides the content at a given breakpoint. By default, content is shown. The primary use case is for visual presentation.
* Mix `<Hide above="md">` with `<Show above="md">` to achieve content that shifts at a breakpoint.
*
* Please note:
* - This only uses `display: none` 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 Hide = exports.Hide = function Hide(_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)([above && styles["above.".concat(above)], below && styles["below.".concat(below)], xcss])
}, children);
};