'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _pxTableRowStyle = require('./px-table-row-style.scss');

var _pxTableRowStyle2 = _interopRequireDefault(_pxTableRowStyle);

var _classnames = require('classnames');

var _classnames2 = _interopRequireDefault(_classnames);

var _Icon = require('../IconSet/Icon');

var _Icon2 = _interopRequireDefault(_Icon);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var TableRow = function TableRow(_ref) {
  var _ref$title = _ref.title,
      title = _ref$title === undefined ? 'Row Title' : _ref$title,
      subtitle = _ref.subtitle,
      body = _ref.body,
      image = _ref.image,
      icon = _ref.icon,
      labelLeft = _ref.labelLeft,
      labelRight = _ref.labelRight,
      iconLeft = _ref.iconLeft,
      iconRight = _ref.iconRight,
      editMode = _ref.editMode,
      tappable = _ref.tappable,
      underlayContent = _ref.underlayContent,
      rowContent = _ref.rowContent,
      children = _ref.children;


  var baseClassnames = (0, _classnames2.default)('table-row', { 'table-row--tappable': tappable });

  var mediaClassnames = (0, _classnames2.default)('table-row__media', { 'table-row__media--icon': icon || iconLeft || iconRight }, { 'table-row__media--left': icon || iconLeft }, { 'table-row__media--right': iconRight });

  return _react2.default.createElement(
    'div',
    { className: 'px-table-row' },
    _react2.default.createElement(
      'div',
      { className: baseClassnames },
      labelLeft && _react2.default.createElement(
        'span',
        { className: 'table-row__label table-row__label--left' },
        labelLeft
      ),
      image && _react2.default.createElement(
        'div',
        { className: 'table-row__media table-row__media--image' },
        _react2.default.createElement('img', { src: image, alt: title })
      ),
      icon && _react2.default.createElement(
        'div',
        { className: mediaClassnames },
        _react2.default.createElement(_Icon2.default, { icon: icon })
      ),
      (iconLeft || iconLeft) && _react2.default.createElement(
        'div',
        { className: mediaClassnames },
        _react2.default.createElement(_Icon2.default, { icon: icon })
      ),
      editMode && _react2.default.createElement(
        'div',
        { className: 'table-row__media table-row__media--icon table-row__media--right' },
        _react2.default.createElement(
          'button',
          { className: 'btn btn--bare table-row__handle' },
          'hamburger'
        )
      ),
      labelRight && _react2.default.createElement(
        'span',
        { className: 'table-row__label table-row__label--right' },
        labelRight
      ),
      _react2.default.createElement(
        'div',
        { className: 'table-row__content' },
        title && _react2.default.createElement(
          'span',
          { className: 'table-row__title' },
          title
        ),
        subtitle && _react2.default.createElement(
          'span',
          { className: 'table-row__subtitle' },
          subtitle
        ),
        body && _react2.default.createElement(
          'span',
          { className: 'table-row__body' },
          body
        ),
        rowContent
      )
    ),
    _react2.default.createElement(
      'div',
      { className: 'table-row__content' },
      children
    ),
    _react2.default.createElement(
      'div',
      { id: 'underlay', className: 'flex flex--stretch' },
      underlayContent
    )
  );
};
TableRow.displayName = 'TableRow';

exports.default = TableRow;