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-08-07 10:57:54 +00:00
|
|
|
const SectionBody = React.memo(props => {
|
2019-07-28 20:39:59 +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-08-07 10:57:54 +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-08-07 10:57:54 +00:00
|
|
|
SectionBody.propTypes = {
|
|
|
|
withScroll: PropTypes.bool
|
|
|
|
};
|
|
|
|
|
|
|
|
SectionBody.defaultProps = {
|
|
|
|
withScroll: true
|
|
|
|
};
|
|
|
|
|
|
|
|
export default SectionBody;
|