import React from 'react';
import Icon from 'trc-client-core/src/components/Icon';

var PrintChartView = React.createClass({
    displayName: 'PrintChartView',
    propTypes: {
        showDownload: React.PropTypes.bool
    },
    onPrint() {
        window.print();
    },
    render: function () {
        return (
            <div className="row t-right hide-print">
                {this.renderDownloadButton()}
                <a className="inline" onClick={this.onPrint}>
                    <Icon name="print" modifier="small inline" className="margin-left"/>
                    print
                </a>
            </div>
        );
    },
    renderDownloadButton() {
        if(this.props.href) {
            return <a className="inline" href={this.props.href}>
                <Icon name="download" modifier="small inline" className="margin-left"/>
                download
            </a>;
        }
    }
});

module.exports = PrintChartView;
