wix-style-react
Version:
wix-style-react
26 lines • 1.29 kB
JavaScript
import React from 'react';
import PropTypes from 'prop-types';
import { st, classes } from './SidebarSectionTitle.st.css';
import Text from '../Text';
import { SidebarContext } from '../Sidebar/SidebarAPI';
import { sidebarSkins } from '../Sidebar/constants';
import { WixStyleReactContext } from '../WixStyleReactProvider/context';
/** A title for the section within the sidebar */
class SidebarSectionTitle extends React.PureComponent {
render() {
const { dataHook, children } = this.props;
return (React.createElement(WixStyleReactContext.Consumer, null, () => (React.createElement(SidebarContext.Consumer, null, context => {
const skin = (context && context.getSkin()) || sidebarSkins.dark;
return (React.createElement(Text, { dataHook: dataHook, className: st(classes.root, { skin }), size: "tiny", weight: "bold" }, children));
}))));
}
}
SidebarSectionTitle.displayName = 'SidebarSectionTitle';
SidebarSectionTitle.propTypes = {
/** Applied as data-hook HTML attribute that can be used in the tests */
dataHook: PropTypes.string,
/** Usually plain text, but could be any renderable node */
children: PropTypes.node.isRequired,
};
export default SidebarSectionTitle;
//# sourceMappingURL=SidebarSectionTitle.js.map