import { extend, mergeData } from '../../vue';
import { NAME_MEDIA_ASIDE } from '../../constants/components';
import { PROP_TYPE_BOOLEAN, PROP_TYPE_STRING } from '../../constants/props';
import { makePropsConfigurable, makeProp } from '../../utils/props';

// --- Props ---

const props = makePropsConfigurable({
  right: makeProp(PROP_TYPE_BOOLEAN, false),
  tag: makeProp(PROP_TYPE_STRING, 'div'),
  verticalAlign: makeProp(PROP_TYPE_STRING, 'top')
}, NAME_MEDIA_ASIDE);

// --- Main component ---

// @vue/component
const BMediaAside = /*#__PURE__*/extend({
  name: NAME_MEDIA_ASIDE,
  functional: true,
  props,
  render(h, _ref) {
    let {
      props,
      data,
      children
    } = _ref;
    const {
      verticalAlign
    } = props;
    const align = verticalAlign === 'top' ? 'start' : verticalAlign === 'bottom' ? 'end' : /* istanbul ignore next */verticalAlign;
    return h(props.tag, mergeData(data, {
      staticClass: 'media-aside',
      class: {
        'media-aside-right': props.right,
        [`align-self-${align}`]: align
      }
    }), children);
  }
});

export { BMediaAside, props };
