import React from 'react'; import PropTypes from 'prop-types'; export default class AuthMenu extends React.Component { constructor(props) { super(props); this.state = { show: false }; } onToggle = () => { this.setState({ show: !this.state.show }); } onEdit = () => { this.onToggle(); this.props.onEdit(); } onRemove = () => { this.onToggle(); this.props.onRemove(); } render() { const { buttonColor } = this.props; const buttonStyle = {}; if (buttonColor) { buttonStyle.color = buttonColor; } return (
•••
{this.state.show && (
,
Edit
Remove
)}
); } } AuthMenu.propTypes = { onEdit: PropTypes.func.isRequired, onRemove: PropTypes.func.isRequired, buttonColor: PropTypes.string };