# All files / layouts/Pane PaneSection.js

0% Statements 0/2
0% Branches 0/2
0% Functions 0/1
0% Lines 0/2

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60

     import React from 'react';
    import PropTypes from 'prop-types';
    import PaneSectionContent from './styles/PaneSectionContent';
    import PaneSectionTitle from './styles/PaneSectionTitle';
    import PaneSectionWrap from './styles/PaneSectionWrap';

    class PaneSection extends React.Component {
      static propTypes = {
        /**
         * Optional title for the top of the pane section.
         */
        title: PropTypes.string,
        /**
         * Pane section contents.
         */
        children: PropTypes.node.isRequired,
        /**
         * Adds an id to the section.
         */
        id: PropTypes.string,
        /**
         * Adds a class name to the section.
         */
        className: PropTypes.string,
        /**
         * A component to render the content of the pane section
         */
        Content: PropTypes.func,
        /**
         * A component to render the title of the pane section
         */
        Title: PropTypes.func,
        /**
         * A component to render the outer wrapper of the pane section
         */
        Wrap: PropTypes.func,
      };

      static defaultProps = {
        title: null,
        id: null,
        className: null,
        Content: PaneSectionContent,
        Title: PaneSectionTitle,
        Wrap: PaneSectionWrap,
      };

      render() {
        const { title, children, id, className, Wrap, Title, Content } = this.props;
        return (
          <Wrap id={id} className={className}>
            {title ? <Title>{title}</Title> : null}
            <Content>{children}</Content>
          </Wrap>
        );
      }
    }

    export default PaneSection;