import * as React from 'react'; import _ from 'lodash'; import { observer } from 'mobx-react'; import { computed, makeObservable } from 'mobx'; import styles from './styles.module.scss'; import classnames from 'classnames'; export interface IGroupLogicProps { components: JSX.Element[]; operation: string; group: boolean; } @observer export class GroupLogic extends React.Component { constructor(props: any) { super(props); makeObservable(this); } @computed get child() { let elements = []; if (this.props.group) { elements.push( ( ); } _.reduce( this.props.components, (acc, next, index): any => { if (index > 0) { acc.push( {this.props.operation} ); } acc.push(next); return acc; }, elements ); if (this.props.group) { elements.push( ) ); } return elements; } render() { return
{this.child}
; } }