import React from 'react'; import ProfileNavbar from './profile_navbar'; class ProfileCover extends React.Component { handleChange(e, type) { const photoData = new FormData(); photoData.append(`user[${type}]`, e.currentTarget.files[0]); this.props.updatePhoto(this.props.currentUserId, photoData); } photoOverlay(type) { if (this.props.currentUserId === this.props.user.id) { return (
document.getElementById(`photo-upload-${type}`).click()}> this.handleChange(e, type)} />
); } else { return null; } } render() { return (
{this.photoOverlay("coverPhoto")}
{this.photoOverlay("profilePicture")}
{this.props.user.fname} {this.props.user.lname}
{/* */}
); } } export default ProfileCover;