import React, {Component} from 'react';

class ProfileAddress extends Component {

    render() {
        const {profileAddress, openAddressDialog} = this.props;

        return (
            <div className="address-row">
                <div className="address-text">
                    <div className="small-address-title">
                        {profileAddress.firstName} {profileAddress.lastName}
                        {
                            profileAddress.deliveryMail &&
                            <span>( {profileAddress.deliveryMail} )</span>
                        }
                    </div>
                    <div>
                        {profileAddress.countryName}, {profileAddress.city}, {profileAddress.detailedAddress}, {profileAddress.zipCode}
                    </div>
                </div>
                <div className="address-icons">
                    <i className="fa fa-pencil control-icon edit-address-btn"
                        onClick={()=> {openAddressDialog('edit', profileAddress)}}
                        id="edit-address-btn"
                        aria-hidden="true"></i>
                    <i className="fa fa-trash control-icon remove-address-btn"
                        onClick={()=> {openAddressDialog('remove', profileAddress)}}
                        id="remove-address-btn"
                        aria-hidden="true"></i>
                </div>
            </div>
        );
    }
}

export default ProfileAddress;
