Skip to content
This repository was archived by the owner on Jun 3, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions dist-modules/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,14 +363,24 @@ var Sidebar = function (_Component) {
}
}

var sideBar = this.props.sidebarElement === 'nav' ? _react2.default.createElement(
'nav',
{ className: this.props.sidebarClassName,
style: sidebarStyle,
ref: this.saveSidebarRef },
this.props.sidebar
) : _react2.default.createElement(
'div',
{ className: this.props.sidebarClassName,
style: sidebarStyle,
ref: this.saveSidebarRef },
this.props.sidebar
);

return _react2.default.createElement(
'div',
rootProps,
_react2.default.createElement(
'div',
{ className: this.props.sidebarClassName, style: sidebarStyle, ref: this.saveSidebarRef },
this.props.sidebar
),
sideBar,
_react2.default.createElement('div', { className: this.props.overlayClassName,
style: overlayStyle,
role: 'presentation',
Expand Down Expand Up @@ -439,6 +449,9 @@ Sidebar.propTypes = {
// Enable/Disable sidebar shadow
shadow: _propTypes2.default.bool,

// if an element other than 'div' is to be rendered as the sidebar root.
sidebarElement: _propTypes2.default.string,

// distance we have to drag the sidebar to toggle open state
dragToggleDistance: _propTypes2.default.number,

Expand All @@ -457,6 +470,7 @@ Sidebar.defaultProps = {
touchHandleWidth: 20,
pullRight: false,
shadow: true,
sidebarElement: 'div',
dragToggleDistance: 30,
onSetOpen: function onSetOpen() {},
styles: {},
Expand Down
22 changes: 19 additions & 3 deletions src/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,23 @@ class Sidebar extends Component {
}
}

const sideBar = this.props.sidebarElement === 'nav'
? <nav className={this.props.sidebarClassName}
style={sidebarStyle}
ref={this.saveSidebarRef}>
{this.props.sidebar}
</nav>
: <div className={this.props.sidebarClassName}
style={sidebarStyle}
ref={this.saveSidebarRef}>
{this.props.sidebar}
</div>;

return (
<div {...rootProps}>
<div className={this.props.sidebarClassName} style={sidebarStyle} ref={this.saveSidebarRef}>
{this.props.sidebar}
</div>

{sideBar}

<div className={this.props.overlayClassName}
style={overlayStyle}
role="presentation"
Expand Down Expand Up @@ -386,6 +398,9 @@ Sidebar.propTypes = {
// Enable/Disable sidebar shadow
shadow: PropTypes.bool,

// if an element other than 'div' is to be rendered as the sidebar root.
sidebarElement: PropTypes.string,

// distance we have to drag the sidebar to toggle open state
dragToggleDistance: PropTypes.number,

Expand All @@ -404,6 +419,7 @@ Sidebar.defaultProps = {
touchHandleWidth: 20,
pullRight: false,
shadow: true,
sidebarElement: 'div',
dragToggleDistance: 30,
onSetOpen: () => {},
styles: {},
Expand Down