import React, { Component } from 'react';


require('./PageTitle.scss');

export default (props) => {
    let { title, titleIcon, children, size = "normal" } = props;

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

    let h = null;
    switch(size) {
        case "small": 
            h = <h3>{ icon }{ title }</h3>
            break;
        case "normal": 
            h = <h2>{ icon }{ title }</h2>
            break;
        default:
            h = <h1 className="pageTitle">{ icon }{ title }</h1>
    }

    return (
        <div className="page-title">
            { h }
            { children }
        </div>
    );
}

