2024-03-26 05:13:57 +08:00
|
|
|
import React from 'react';
|
2024-06-11 03:31:30 +08:00
|
|
|
import * as Styled from '../styles';
|
2024-06-15 02:32:55 +08:00
|
|
|
import { GenericContentMainAreaProps } from '../types';
|
2024-06-11 03:31:30 +08:00
|
|
|
import GenericContentItem from '../generic-content-item/component';
|
2024-02-19 18:59:45 +08:00
|
|
|
|
2024-06-15 02:32:55 +08:00
|
|
|
const GenericMainContent: React.FC<GenericContentMainAreaProps> = ({
|
2024-02-19 18:59:45 +08:00
|
|
|
isResizing,
|
2024-06-11 03:31:30 +08:00
|
|
|
genericContentLayoutInformation,
|
2024-02-19 18:59:45 +08:00
|
|
|
renderFunctionComponents,
|
2024-06-11 03:31:30 +08:00
|
|
|
genericContentId,
|
2024-02-19 18:59:45 +08:00
|
|
|
}) => {
|
|
|
|
const {
|
|
|
|
height,
|
|
|
|
width,
|
|
|
|
top,
|
|
|
|
left,
|
|
|
|
right,
|
2024-06-11 03:31:30 +08:00
|
|
|
} = genericContentLayoutInformation;
|
2024-02-19 18:59:45 +08:00
|
|
|
|
|
|
|
const isMinimized = width === 0 && height === 0;
|
|
|
|
|
2024-06-11 03:31:30 +08:00
|
|
|
const componentToRender = renderFunctionComponents.filter((g) => genericContentId === g.id);
|
2024-02-19 18:59:45 +08:00
|
|
|
return (
|
|
|
|
<Styled.Container
|
|
|
|
style={{
|
|
|
|
height,
|
|
|
|
width,
|
|
|
|
top,
|
|
|
|
left,
|
|
|
|
right,
|
|
|
|
}}
|
|
|
|
isResizing={isResizing}
|
|
|
|
isMinimized={isMinimized}
|
|
|
|
>
|
2024-06-11 03:31:30 +08:00
|
|
|
<GenericContentItem
|
2024-03-26 05:13:57 +08:00
|
|
|
key={componentToRender[0]?.id}
|
|
|
|
renderFunction={componentToRender[0]?.contentFunction}
|
|
|
|
/>
|
2024-02-19 18:59:45 +08:00
|
|
|
</Styled.Container>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2024-06-11 03:31:30 +08:00
|
|
|
export default GenericMainContent;
|