/** @jsx createElement */

import { Component, createElement, render } from 'rax';
import View from 'nuke-view';

class Col extends Component {
  render() {
    const style = {
      ...styles.initial,
      ...this.props.style,
    };

    const children = this.props.children;
    const length = children.length;

    if (length) {
      return <View {...this.props} style={style} />;
    }
    children.props.style = Object.assign({}, style, children.props.style);

    return children;
  }
}

const styles = {
  initial: {
    flex: 1,
    display: 'flex',
  },
};

export default Col;
