import { Component, Fragment } from 'react'; import classNames from 'classnames'; import { observer } from '@alilc/lowcode-editor-core'; import { Area } from '@alilc/lowcode-editor-skeleton'; @observer export default class SubTopArea extends Component<{ area: Area; itemClassName?: string }> { render() { const { area, itemClassName } = this.props; if (area.isEmpty()) { return null; } return (
); } } @observer class Contents extends Component<{ area: Area; itemClassName?: string }> { render() { const { area, itemClassName } = this.props; const left: any[] = []; const center: any[] = []; const right: any[] = []; area.container.items.slice().sort((a, b) => { const index1 = a.config?.index || 0; const index2 = b.config?.index || 0; return index1 === index2 ? 0 : (index1 > index2 ? 1 : -1); }).forEach(item => { const content = (
{item.content}
); if (item.align === 'center') { center.push(content); } else if (item.align === 'left') { left.push(content); } else { right.push(content); } }); let children = []; if (left && left.length) { children.push(
{left}
); } if (center && center.length) { children.push(
{center}
); } if (right && right.length) { children.push(
{right}
); } return ( {children} ); } }