import { Theme, BackgroundLevel, FontLevel } from "@Component/Theme/Theme"; import { ILayout, LayoutDirection } from "@Model/Layout"; import { Component, ReactNode } from "react"; import "./Container.scss"; interface IContainerProps extends ILayout { showBar?: boolean; isRoot?: boolean; } function getPanelById(id: string) { return {id} } class Container extends Component { private renderPanel(panles: string[], showBar: boolean) { return <> {showBar ? { panles.map((panelId: string) => { return
{panelId}
}) }
: null } {getPanelById(panles[0])} } private renderContainer( props: IContainerProps, selfScale: number = 50, selfLayout: LayoutDirection = LayoutDirection.Y ) { const items: [IContainerProps, IContainerProps] | undefined = props.items; const showBar: boolean = props.showBar ?? true; const panles: string[] = props.panles ?? []; const layout: LayoutDirection = props.layout ?? LayoutDirection.Y; const scale: number = props.scale ?? 50; const isRoot: boolean = !!props.isRoot; return 0 && !items ? " end-containe" : "")} backgroundLevel={BackgroundLevel.Level4} fontLevel={FontLevel.normal} style={{ flexDirection: layout === LayoutDirection.Y ? "column" : undefined, width: isRoot ? "100%" : selfLayout === LayoutDirection.X ? `${selfScale}%` : undefined, height: isRoot ? "100%" : selfLayout === LayoutDirection.Y ? `${selfScale}%` : undefined }} > {panles.length > 0 && !items ? this.renderPanel(panles, showBar) : null} {items && items[0] ? this.renderContainer(items[0], scale, layout) : null} {items && items[1] ?
: null} {items && items[1] ? this.renderContainer(items[1], 100 - scale, layout) : null}
} public render(): ReactNode { return this.renderContainer(this.props); } } export { Container };