import React, { Component } from 'react';

import { ButtonBar, Button, Alert } from './index.js';


class ListButtons extends Component {


	render() {
		let pending = this.props.pending;
		return (
			<ButtonBar>
				{ this.props.cancel ? (
					<Button 
						disabled={ pending }
						title={ this.props.cancelTitle || "Back" }
						onPress={ typeof this.props.onCancel == "function" ? () => this.props.onCancel() : null }
						/>
					) : null }

				{ this.props.export ? (
					<Button 
						disabled={ pending }
						title={ this.props.exportTitle || "Export" }
						onPress={ typeof this.props.onExport == "function" ? () => this.props.onExport() : null }
						/>
					) : null }
				
				{ this.props.import ? (
					<Button 
						disabled={ pending }
						title={ this.props.importTitle || "Import" }
						onPress={ typeof this.props.onImport == "function" ? () => this.props.onImport() : null }
						/>
					) : null }
				
				{ this.props.children }

				{ this.props.add ? (
					<Button 
						disabled={ pending }
						title={ this.props.addTitle || "Save" }
						onPress={ typeof this.props.onAdd == "function" ? () => this.props.onAdd() : null }
						/>
					) : null }
			</ButtonBar>
		);
	}

}


export default ListButtons;