react-cm-ui
Version:
React UI for Healthy Church
63 lines (51 loc) • 1.69 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var propTypes = {
/**
* Children to be rendered when the getContent function is undefined/null.
*/
children: _propTypes["default"].oneOfType([_propTypes["default"].array, _propTypes["default"].object, _propTypes["default"].string]),
/**
* Class names to potentially override styling.
*/
classNames: _propTypes["default"].string.isRequired,
/**
* Main function to get the content, is passed from the <SectionalTabs /> items objects.
* It could return a string, an object or an array.
*/
getContent: _propTypes["default"].func,
/**
* Tab content component identifier.
*/
id: _propTypes["default"].string.isRequired
};
var defaultProps = {
children: undefined,
getContent: undefined
};
function SectionalTabContent(props) {
var children = props.children,
classNames = props.classNames,
getContent = props.getContent,
id = props.id;
var content = getContent && getContent();
var shouldRenderChildren = !getContent && children;
if (shouldRenderChildren) {
content = children;
}
return /*#__PURE__*/_react["default"].createElement("div", {
className: classNames,
role: "tabpanel",
id: id
}, content);
}
SectionalTabContent.propTypes = propTypes;
SectionalTabContent.defaultProps = defaultProps;
var _default = SectionalTabContent;
exports["default"] = _default;