UNPKG

wix-style-react

Version:
30 lines 1.55 kB
import React from 'react'; import PropTypes from 'prop-types'; import { st, classes } from './SidebarDivider.st.css'; import Divider from '../Divider'; import { SidebarContext } from '../Sidebar/SidebarAPI'; import { sidebarSkins } from '../Sidebar/constants'; import { skins as dividerSkins } from '../Divider/constants'; import { WixStyleReactContext } from '../WixStyleReactProvider/context'; /** A divider within the sidebar that supports inner and full mode */ class SidebarDivider extends React.PureComponent { render() { const { dataHook, fullWidth } = this.props; return (React.createElement(WixStyleReactContext.Consumer, null, () => (React.createElement(SidebarContext.Consumer, null, context => { const skin = (context && context.getSkin()) || sidebarSkins.dark; return (React.createElement("div", { "data-hook": dataHook, "data-full-width": fullWidth, className: st(classes.root, fullWidth ? classes.fullWidth : '') }, React.createElement(Divider, { skin: skin === sidebarSkins.light ? dividerSkins.light : dividerSkins.dark, className: classes.divider }))); })))); } } SidebarDivider.displayName = 'SidebarDivider'; SidebarDivider.propTypes = { /** Applied as data-hook HTML attribute that can be used in the tests */ dataHook: PropTypes.string, /** Indicates whether to remove the margin from sides */ fullWidth: PropTypes.bool, }; export default SidebarDivider; //# sourceMappingURL=SidebarDivider.js.map