Source: widgets/menu/sections/top.js

define('application/widgets/menu/sections/top', [
    'antie/widgets/component',
    'rofl/widgets/image',
    'rofl/widgets/label'
], function (
    Component,
    Image,
    Label
) {
    'use strict';

    return Component.extend({

        /**
         * Initializes the top menu widget.
         *
         * @param {Object} opts - The widget opts.
         */
        init: function init (opts) {
            var props = opts.props;

            init.base.call(this, props.id);

            this._logo = null;
            this._title = null;

            this.addClass(props.name);

            this._build(opts);
        },

        /**
         * Build top section.
         *
         * @param {Object} opts - The widget opts.
         * @private
         */
        _build: function (opts) {

            if (opts.logo) {
                this._logo = new Image('logo', opts.logo);
                this.appendChildWidget(this._logo);

            } else if (opts.title) {
                this._title = new Label({ text: opts.title });
                this.appendChildWidget(this._title);
            }

        }
    });
});