@atlaskit/side-navigation
Version:
A highly composable side navigation component that supports nested views.
46 lines • 1.4 kB
JavaScript
import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
var _excluded = ["children", "data-testid"];
import React from 'react';
/**
* __Container__
*
* A container for Header and Footer that safely handles props to the child component
*/
var HeaderContainer = function HeaderContainer(_ref) {
var children = _ref.children,
testId = _ref['data-testid'],
props = _objectWithoutProperties(_ref, _excluded);
// https://stackoverflow.com/a/39333479
var safeProps = function (_ref2) {
var className = _ref2.className,
onClick = _ref2.onClick,
onMouseDown = _ref2.onMouseDown,
onDragStart = _ref2.onDragStart,
draggable = _ref2.draggable,
ref = _ref2.ref,
tabIndex = _ref2.tabIndex,
disabled = _ref2.disabled;
return {
className: className,
onClick: onClick,
onMouseDown: onMouseDown,
onDragStart: onDragStart,
draggable: draggable,
ref: ref,
tabIndex: tabIndex,
disabled: disabled
};
}(props);
return (
/*#__PURE__*/
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
React.createElement("div", _extends({
"data-testid": testId,
style: {
position: 'relative'
}
}, safeProps), children)
);
};
export default HeaderContainer;