render()

in modules/core/src/components/declarative-ui/xviz-container.js [33:66]


  render() {
    const {layout} = this.props;

    const layoutStyle = {
      display: 'flex',
      width: '100%'
    };
    const childStyle = {};

    // Normalize enums to uppercase
    switch (layout.toUpperCase()) {
      case 'VERTICAL':
        layoutStyle.flexDirection = 'column';
        childStyle.flex = '0 0 auto';
        break;

      case 'HORIZONTAL':
        layoutStyle.flexDirection = 'row';
        childStyle.flex = '1 1 auto';
        break;

      default:
        // Unknown layout type
        return null;
    }

    return (
      <div className="xviz-container" style={layoutStyle}>
        {React.Children.map(this.props.children, child => (
          <div style={childStyle}>{child}</div>
        ))}
      </div>
    );
  }