@dabapps/roe
Version:
A collection of React components, styles, mixins, and atomic CSS classes to aid with the development of web applications.
45 lines • 2.36 kB
JavaScript
;
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
var classNames = require("classnames");
var React = require("react");
var react_transition_group_1 = require("react-transition-group");
var TIMEOUT = {
appear: 300,
enter: 300,
exit: 200,
};
/**
* SideBar navigation that opens over the content. Often used as the primary navigation on small devices.
* See the [Nav](#nav) section for more details.
*/
var SideBar = function (props) {
var className = props.className, children = props.children, open = props.open, position = props.position, onClickOutside = props.onClickOutside, noShadow = props.noShadow, _a = props.component, Component = _a === void 0 ? 'div' : _a, remainingProps = __rest(props, ["className", "children", "open", "position", "onClickOutside", "noShadow", "component"]);
return (React.createElement("div", { className: classNames('side-bar-container', className) },
React.createElement(react_transition_group_1.TransitionGroup, null, open && (React.createElement(react_transition_group_1.CSSTransition, { classNames: "side-bar-transition", timeout: TIMEOUT },
React.createElement("div", { className: "side-bar-overlay", onClick: onClickOutside })))),
React.createElement(Component, __assign({}, remainingProps, { className: classNames('side-bar', noShadow && 'no-shadow', position, open && 'open') }), children)));
};
exports.default = React.memo(SideBar);
//# sourceMappingURL=side-bar.js.map