Passed
Push — master ( 669be3...4762c7 )
by Guangyu
19:25 queued 10s
created

src/layouts/ContentWithAsideLayout.js   A

Complexity

Total Complexity 1
Complexity/F 0

Size

Lines of Code 34
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 30
mnd 1
bc 1
fnc 0
dl 0
loc 34
rs 10
bpm 0
cpm 0
noi 0
c 0
b 0
f 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