2019-08-07 10:57:54 +00:00
|
|
|
import React from "react";
|
|
|
|
import PropTypes from "prop-types";
|
|
|
|
import styled from "styled-components";
|
|
|
|
import Scrollbar from "../../scrollbar";
|
2019-07-20 09:48:29 +00:00
|
|
|
|
|
|
|
const StyledSectionBody = styled.div`
|
|
|
|
margin: 16px 0;
|
2019-07-29 12:51:56 +00:00
|
|
|
${props => props.displayBorder && `outline: 1px dotted;`}
|
2019-07-20 09:48:29 +00:00
|
|
|
flex-grow: 1;
|
2019-09-10 12:41:52 +00:00
|
|
|
height: 100%;
|
2019-07-20 09:48:29 +00:00
|
|
|
`;
|
|
|
|
|
2019-08-07 10:57:54 +00:00
|
|
|
const SectionBody = React.memo(props => {
|
2019-08-13 11:21:28 +00:00
|
|
|
//console.log("PageLayout SectionBody render");
|
2019-08-07 10:57:54 +00:00
|
|
|
const { children, withScroll } = props;
|
2019-07-20 09:48:29 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<StyledSectionBody>
|
2019-09-12 12:15:22 +00:00
|
|
|
{withScroll ? (
|
|
|
|
<Scrollbar stype="mediumBlack">{children}</Scrollbar>
|
|
|
|
) : (
|
|
|
|
<>{children}</>
|
|
|
|
)}
|
2019-07-20 09:48:29 +00:00
|
|
|
</StyledSectionBody>
|
|
|
|
);
|
2019-07-28 20:39:59 +00:00
|
|
|
});
|
2019-07-20 09:48:29 +00:00
|
|
|
|
2019-09-10 12:41:52 +00:00
|
|
|
SectionBody.displayName = "SectionBody";
|
|
|
|
|
2019-08-07 10:57:54 +00:00
|
|
|
SectionBody.propTypes = {
|
2019-09-10 12:41:52 +00:00
|
|
|
withScroll: PropTypes.bool,
|
|
|
|
children: PropTypes.oneOfType([
|
|
|
|
PropTypes.arrayOf(PropTypes.node),
|
2019-09-12 12:15:22 +00:00
|
|
|
PropTypes.node,
|
|
|
|
PropTypes.any
|
2019-09-10 12:41:52 +00:00
|
|
|
])
|
2019-08-07 10:57:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
SectionBody.defaultProps = {
|
|
|
|
withScroll: true
|
|
|
|
};
|
|
|
|
|
|
|
|
export default SectionBody;
|