'use strict'

import React from 'react';

const Titlebar = React.createClass({

    statics: {

        getDefaultData(){
            return '我是标题栏'
        }
    },

    getDefaultProps() {
        return {
            'data-type': 'Titlebar',
            'tag': 'h2'
        };
    },

    render() {

        var html = this.props.data || Titlebar.getDefaultData()
        var ComponentClass = this.props.tag

        var ContentEditable = this.props.contentEditableClass

        if (this.props.isEditMode) {
            return (
                <ContentEditable
                    {...this.props}
                    html={html}>
                </ContentEditable>
            )
        } else {
            return (<ComponentClass className={this.props.className} {...this.props}
                                    dangerouslySetInnerHTML={{__html: html}}></ComponentClass>)
        }
    }
});

export default Titlebar