content: import React from 'react';
  import {BaseMixin, ElementaryMixin, ColorSchemaMixin, ContentMixin, Tools} from '../common/common.js';
  import Environment from '../environment/environment.js';
  import Footer from './blockquote-footer.js'
  
  import './blockquote.less';
  
  export const Blockquote = React.createClass({
  
    //@@viewOn:mixins
    mixins: [
      BaseMixin,
      ElementaryMixin,
      ColorSchemaMixin,
      ContentMixin
    ],
    //@@viewOff:mixins
  
    //@@viewOn:statics
    statics: {
      tagName: 'UU5.Bricks.Blockquote',
      classNames: {
        main: 'uu5-bricks-blockquote',
        bg: 'uu5-bricks-blockquote-bg',
        right: 'blockquote-reverse'
      }
    },
    //@@viewOff:statics
  
    //@@viewOn:propTypes
    propTypes: {
      background: React.PropTypes.bool,
      alignment: React.PropTypes.oneOf([
        'left',
        'right'
      ]),
      footer: React.PropTypes.any,
      footerAlignment: React.PropTypes.oneOf([
        'left',
        'right'
      ])
    },
    //@@viewOff:propTypes
  
    //@@viewOn:getDefaultProps
    getDefaultProps: function () {
      return {
        background: false,
        alignment: 'left',
        footer: null,
        footerAlignment: null
      };
    },
    //@@viewOff:getDefaultProps
  
    //@@viewOn:standardComponentLifeCycle
    //@@viewOff:standardComponentLifeCycle
  
    //@@viewOn:interface
    //@@viewOff:interface
  
    //@@viewOn:overridingMethods
    //@@viewOff:overridingMethods
  
    //@@viewOn:componentSpecificHelpers
    _buildMainAttrs: function () {
      var mainAttrs = this.buildMainAttrs();
      this.props.background && (mainAttrs.className += ' ' + this.getClassName().bg);
      this.props.alignment === 'right' && (mainAttrs.className += ' ' + this.getClassName().right);
      return mainAttrs;
    },
  
    _getFooterAlignment: function () {
      return this.props.footerAlignment || this.props.alignment;
    },
    //@@viewOff:componentSpecificHelpers
  
    //@@viewOn:render
    render: function () {
      return (
        <blockquote {...this._buildMainAttrs()}>
          {this.getChildren()}
          {this.props.footer && <Footer content={this.props.footer} alignment={this._getFooterAlignment()} />}
          {this.getDisabledCover()}
        </blockquote>
      );
    }
    //@@viewOff:render
  });
  
  var createColoredBlockquote = function (colorSchema, background) {
    return React.createClass({
      render: function () {
        return (
          <Blockquote {...this.props} colorSchema={colorSchema} background={background}>
            {this.props.children && React.Children.toArray(this.props.children)}
          </Blockquote>
        );
      }
    });
  };
  
  Environment.colorSchema.forEach(function (colorSchema) {
    var colorSchemaCapitalize = Tools.getCamelCase(colorSchema);
    Blockquote[colorSchema] = createColoredBlockquote(colorSchema);
    Blockquote['bg' + colorSchemaCapitalize] = createColoredBlockquote(colorSchema, true);
  });
  
  export default Blockquote;