import React from 'react';
import PropTypes from 'prop-types';

/**
 * A stateless component which renders cross icon. It can accept all standard attributes and events.
 */
const BackArrow = props => {
    let aProps={...props};
    delete aProps.parentClassName;
    return (
        <a className={`jp-back-arrow-container ${props.parentClassName}`} 
            role="button" 
            {...aProps}>
            &nbsp;
        </a>
    );
};


export default BackArrow;

BackArrow.propTypes = {
    /** Custom class name which will be added to the Cross Icon */
    parentClassName: PropTypes.string,
    /** Link for redirection */
    href: PropTypes.string,
    /** Event to be triggered on click */
    onClick: PropTypes.func,
    /** Event to be triggered on keypress */
    onKeyPress: PropTypes.func,
    /** ARIA label for the back arrow*/
    'aria-label': PropTypes.string
};

BackArrow.defaultProps = {
    parentClassName: '',
    href: 'javascript:;',
    'aria-label': 'Back'
};