react-toolbox/components/layout/Panel.js

36 lines
802 B
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-10-11 15:23:36 +03:00
const Panel = ({ children, className, onScroll, scrollY, theme }) => {
2016-05-22 19:11:27 +03:00
const _className = classnames(theme.panel, {
[theme.scrollY]: scrollY
2016-04-10 21:45:37 +03:00
}, className);
2016-04-10 21:45:37 +03:00
return (
2016-10-11 15:23:36 +03:00
<div data-react-toolbox='panel' onScroll={onScroll} className={_className}>
2016-04-10 21:45:37 +03:00
{children}
</div>
);
};
Panel.propTypes = {
children: PropTypes.any,
className: PropTypes.string,
2016-10-11 15:23:36 +03:00
onScroll: PropTypes.func,
scrollY: PropTypes.bool,
theme: PropTypes.shape({
panel: PropTypes.string,
scrollY: PropTypes.string
2016-05-22 19:11:27 +03:00
})
};
Panel.defaultProps = {
2016-04-10 21:45:37 +03:00
className: '',
scrollY: false
};
2016-05-29 20:59:17 +03:00
export default themr(LAYOUT)(Panel);
export { Panel };