publiclab/plots2

View on GitHub
app/javascript/components/CommentToolbarButton.js

Summary

Maintainability
A
0 mins
Test Coverage
import React from "react";
import PropTypes from "prop-types";

const CommentToolbarButton = ({
  buttonType,
  icon,
  onClick
}) => {
  let additionalClass;
  
  switch(buttonType) {
    case "edit":
      additionalClass = " edit-comment-btn";
      break;
    case "delete":
      additionalClass = " delete-comment-btn";
      break;
    default:
      additionalClass = "";
  }

  return (
    <a 
      className={"btn btn-outline-secondary btn-sm" + additionalClass}
      onClick={onClick}
    >
      {icon}
    </a>
  );
}

CommentToolbarButton.propTypes = {
  buttonType: PropTypes.string,
  icon: PropTypes.element,
  onClick: PropTypes.func
};

export default CommentToolbarButton;