import * as React from 'react';
import * as s from './VisibilityWrapper.scss';

export interface IVisibilityWrapperProps {
  children?: React.ReactElement<any>;
  visible?: boolean;
  display?: boolean;
}

class VisibilityWrapper extends React.Component<IVisibilityWrapperProps, any> {
  static defaultProps = {
    display: true,
    visible: true
  };

  render() {
    const { visible, display, children } = this.props;
    return (
      <div className={visible ? '' : s.hide}>
        {display ? children : null}
      </div>
    );
  }
}

export default VisibilityWrapper;
