vue-styleguidist
Version:
Vue components style guide generator
43 lines • 1.62 kB
JavaScript
import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
var _excluded = ["slotName", "slotProps", "children", "id"];
import React from 'react';
import PropTypes from 'prop-types';
import Slot from 'rsg-components/Slot';
import SectionHeadingRenderer from 'rsg-components/SectionHeading/SectionHeadingRenderer';
var localPropTypes = {
children: PropTypes.node,
id: PropTypes.string.isRequired,
slotName: PropTypes.string.isRequired,
slotProps: PropTypes.shape({
isolated: PropTypes.bool.isRequired,
parentComponent: PropTypes.shape({
href: PropTypes.string.isRequired,
visibleName: PropTypes.string.isRequired
})
}).isRequired,
href: PropTypes.string,
depth: PropTypes.number.isRequired,
deprecated: PropTypes.bool,
pagePerSection: PropTypes.bool
};
var SectionHeading = function SectionHeading(_ref) {
var slotName = _ref.slotName,
slotProps = _ref.slotProps,
children = _ref.children,
id = _ref.id,
rest = _objectWithoutProperties(_ref, _excluded);
var parentHref = slotProps.parentComponent && slotProps.parentComponent.href;
return /*#__PURE__*/React.createElement(SectionHeadingRenderer, _extends({
toolbar: slotProps.parentComponent ? null : /*#__PURE__*/React.createElement(Slot, {
name: slotName,
props: slotProps
}),
id: id
}, rest, {
parentName: slotProps.parentComponent && slotProps.parentComponent.visibleName,
parentHref: parentHref
}), children);
};
SectionHeading.propTypes = localPropTypes;
export default SectionHeading;