import React, { Component } from 'react';


/*
TODO implement properly 
*/

class TitleSection extends Component {

	render() {
		let title = this.props.title;
		if (!title) {
			return null;
		}

		document.title = title;
		if (this.props.hidden) {
			return null;
		}

		let icon = null;
		if (this.props.titleIcon) {
			icon = (<span className="icon">{ this.props.titleIcon }</span>);
		}

		return (
			<div className="page-title">
				<h1 className="pageTitle">{ icon }{ title }</h1>
				{ this.props.children }
			</div>
		);
	}

}


export default TitleSection;