From 0e9112974387b03507de12c7739878746aa23d19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20Schr=C3=B6tler?= <niklas@allround.digital> Date: Sun, 26 Nov 2023 21:00:11 +0100 Subject: [PATCH] LayoutElement: Implemented reflecting layout from config --- src/layout/LayoutElement.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/layout/LayoutElement.tsx b/src/layout/LayoutElement.tsx index 59a4e43..6eb2dbf 100644 --- a/src/layout/LayoutElement.tsx +++ b/src/layout/LayoutElement.tsx @@ -1,9 +1,16 @@ import React from 'react'; +import {PanelDefinition} from "../types/LayoutConfig"; -const LayoutElement = (props: {children: any}) => { - // const LayoutElement = (props: {config: Layout}) => { +const LayoutElement = (props: {children: any, config: PanelDefinition<any>}) => { return ( - <div className={"absolute"} style={{gridRowStart: 5, gridRowEnd: "span 2", gridColumnStart: 2, gridColumnEnd: "span 5"}}> + <div + style={{ + gridColumnStart: props.config.position.x + 1, + gridColumnEnd: props.config.position.x + props.config.position.w + 1, + gridRowStart: props.config.position.y + 1, + gridRowEnd: props.config.position.y + props.config.position.h + 1 + }} + > {props.children} </div> ); -- GitLab