react-toolbox/components/layout/Sidebar.js

47 lines
1.2 KiB
JavaScript
Raw Normal View History

import React, { PropTypes } from 'react';
2016-04-10 21:45:37 +03:00
import classnames from 'classnames';
2016-05-22 19:11:27 +03:00
import { themr } from 'react-css-themr';
2016-05-29 20:59:17 +03:00
import { LAYOUT } from '../identifiers.js';
2016-05-22 19:11:27 +03:00
const Sidebar = ({ children, className, pinned, scrollY, theme, width }) => {
const wrapperClasses = classnames(theme.sidebar, theme[`width-${width}`], {
[theme.pinned]: pinned
}, className);
2016-05-22 19:11:27 +03:00
const innerClasses = classnames(theme.sidebarContent, {
[theme.scrollY]: scrollY
2016-04-10 21:45:37 +03:00
});
2016-04-10 21:45:37 +03:00
return (
<div data-react-toolbox='sidebar' className={wrapperClasses}>
<aside data-react-toolbox='sidebar-content' className={innerClasses}>
2016-05-22 19:11:27 +03:00
{children}
2016-04-10 21:45:37 +03:00
</aside>
</div>
);
};
Sidebar.propTypes = {
children: PropTypes.any,
className: PropTypes.string,
pinned: PropTypes.bool,
scrollY: PropTypes.bool,
theme: PropTypes.shape({
pinned: PropTypes.string,
scrollY: PropTypes.string,
sidebar: PropTypes.string,
sidebarContent: PropTypes.string
2016-05-22 19:11:27 +03:00
}),
width: PropTypes.oneOf([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 25, 33, 50, 66, 75, 100])
};
Sidebar.defaultProps = {
2016-04-10 21:45:37 +03:00
className: '',
pinned: false,
scrollY: false,
width: 5
};
2016-05-29 20:59:17 +03:00
export default themr(LAYOUT)(Sidebar);
export { Sidebar };