import React, {Component} from 'react'
import './index.scss';

class HeaderBar extends Component {
    constructor(props) {
        super(props);
    }

    goBack = () => {
        window.history.go(-1);
    }
    goShop = () => {
        location.replace('/shopcart');
    }

    render() {
        return (
            <div className="detail-header" style={{...this.props.style}}>
                {
                    this.props.arrow &&
                    <i className='iconfont iconiconfront-68' onClick={this.goBack}></i>
                }
                <span className='herder'>{this.props.title}</span>
                {
                    this.props.cart &&
                    <i className='iconfont icongouwuche-xianxing' onClick={this.goShop}></i>
                }
                {
                    this.props.delete &&
                    <i className='iconfont iconiconfront-56' onClick={this.props.toDelete}></i>
                }
            </div>
        );
    }
};

export default HeaderBar;
