| Total Complexity | 1 |
| Complexity/F | 0 |
| Lines of Code | 34 |
| Function Count | 0 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import React, { Fragment } from 'react'; |
||
| 2 | import PropTypes from 'prop-types'; |
||
| 3 | import classNames from 'classnames'; |
||
| 4 | import { Row, Col } from 'reactstrap'; |
||
| 5 | |||
| 6 | const ContentWithAsideLayout = ({ banner, aside, footer, isStickyAside, children }) => { |
||
| 7 | return ( |
||
| 8 | <Fragment> |
||
| 9 | {banner} |
||
| 10 | <Row noGutters> |
||
| 11 | <Col lg="8" className={classNames('pr-lg-2', { 'mb-3': !isStickyAside })}> |
||
| 12 | {children} |
||
| 13 | </Col> |
||
| 14 | <Col lg="4" className={classNames('pl-lg-2', { 'mb-3': !isStickyAside })}> |
||
| 15 | {isStickyAside ? <div className="sticky-top sticky-sidebar">{aside}</div> : aside} |
||
| 16 | </Col> |
||
| 17 | </Row> |
||
| 18 | {footer} |
||
| 19 | </Fragment> |
||
| 20 | ); |
||
| 21 | }; |
||
| 22 | |||
| 23 | ContentWithAsideLayout.propTypes = { |
||
| 24 | aside: PropTypes.element.isRequired, |
||
| 25 | banner: PropTypes.element, |
||
| 26 | footer: PropTypes.element, |
||
| 27 | isStickyAside: PropTypes.bool, |
||
| 28 | children: PropTypes.node |
||
| 29 | }; |
||
| 30 | |||
| 31 | ContentWithAsideLayout.defaultProps = { isStickyAside: true }; |
||
| 32 | |||
| 33 | export default ContentWithAsideLayout; |
||
| 34 |