All files / lib/ListSeparator index.js

100% Statements 6/6
87.5% Branches 14/16
100% Functions 1/1
100% Lines 6/6
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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83                  89x                   8x   8x                                                               89x                                 89x                   89x    
import React from 'react';
import PropTypes from 'prop-types';
 
/**
 * @category containers
 * @component list-separator
 * @variations collab-ui-react
 */
 
const ListSeparator = props => {
  const {
    children,
    className,
    lineColor,
    margin,
    textColor,
    text,
    textPadding,
    ...otherProps
  } = props;
 
  return (
    <div
      className={
        'cui-list-separator' +
        `${className && ` ${className}` || ''}`
      }
      style={{
        ...lineColor && {color: lineColor},
        ...margin && {margin: margin},
      }}
      {...otherProps}
    >
 
    <span className="cui-list-separator__container">
      {
        children || text
        &&
          <span
            className='cui-list-separator__text'
            style={{
              ...textColor && {color: textColor},
              ...textPadding && {padding: textPadding},
            }}
          >
            {children ? children : text}
          </span>
      }
      </span>
    </div>
  );
};
 
ListSeparator.propTypes = {
  /** @prop Children nodes to render inside ListSeparator | null */
  children: PropTypes.node,
  /** @prop Optional css class name | null */
  className: PropTypes.string,
  /** @prop Color of the ListSeparator line | null */
  lineColor: PropTypes.string,
  /** @prop Margin of the ListSeparator | null */
  margin: PropTypes.string,
  /** @prop Text of the ListSeparator | null */
  text: PropTypes.string,
  /** @prop TextColor of the ListSeparator | null */
  textColor: PropTypes.string,
  /** @prop Padding around text of the ListSeparator | null */
  textPadding:PropTypes.string,
};
 
ListSeparator.defaultProps = {
  children: null,
  className: null,
  lineColor: null,
  margin: null,
  text: null,
  textColor: null,
  textPadding: null,
};
 
ListSeparator.displayName = 'ListSeparator';
 
export default ListSeparator;