import React from 'react'; import { connect } from 'react-redux'; import { showModal } from '../../actions/ui_actions'; const mapStateToProps = state => ({ currentUserId: state.session.currentUserId }) const mapDispatchToProps = dispatch => ({ showModal: (modalType, modalProps) => dispatch(showModal(modalType, modalProps)) }) class PostEditButton extends React.Component { openDropdown(e) { document .getElementById(`post-dropdown-${this.props.post.id}`) .classList.add("edit-dropdown-visible"); document .getElementById(`post-background-${this.props.post.id}`) .classList.add("edit-dropdown-visible"); } closeDropdown(e) { document .getElementById(`post-dropdown-${this.props.post.id}`) .classList.remove("edit-dropdown-visible"); document .getElementById(`post-background-${this.props.post.id}`) .classList.remove("edit-dropdown-visible"); } render() { const { post, currentUserId } = this.props; if (post.authorId === currentUserId) { return (
this.openDropdown(e)}>
this.closeDropdown(e)}>

); } else { return null; } } } /*
this.openDropdown()} />
*/ export default connect(mapStateToProps, mapDispatchToProps)(PostEditButton);