huridocs/uwazi

View on GitHub
app/react/Entities/components/ShowSidepanelMenu.js

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
/** @format */

import React, { Component } from 'react';
import PropTypes from 'prop-types';

import ShowIf from 'app/App/ShowIf';
import { Icon } from 'UI';

export class ShowSidepanelMenu extends Component {
  render() {
    const { panelIsOpen, openPanel, active } = this.props;
    return (
      <div className={active ? 'active' : ''}>
        <ShowIf if={!panelIsOpen}>
          <div className="btn btn-primary" onClick={e => openPanel(e)}>
            <Icon icon="columns" />
          </div>
        </ShowIf>
      </div>
    );
  }
}

ShowSidepanelMenu.defaultProps = {
  active: false,
};

ShowSidepanelMenu.propTypes = {
  active: PropTypes.bool,
  panelIsOpen: PropTypes.bool.isRequired,
  openPanel: PropTypes.func.isRequired,
};