ToolJet/frontend/src/Editor/Components/Container.jsx
Navaneeth Pk 4d6906503b
[WIP] Widget: List view (#1575)
* list view initial commit

* More stuffs

* More stuffs

* Minor changes

* merge fixes

* Minor changes

* Fix misspelt variable name that caused data to not show up

* Merge conflicts

* Fix lint for ListView component

* Update ListView to new API

* Fixes

* Fixes

* Fix radio

* Fix

* Lint fixes

* Set icon for List View widget

* Fix list view within tabs

* Fix

Co-authored-by: Sherfin Shamsudeen <sherfin94@gmail.com>
2022-01-14 13:57:31 +05:30

44 lines
1.3 KiB
JavaScript

import React, { useRef } from 'react';
import { SubCustomDragLayer } from '../SubCustomDragLayer';
import { SubContainer } from '../SubContainer';
export const Container = function Container({ id, component, width, height, containerProps, removeComponent, styles }) {
const { backgroundColor, visibility, disabledState, borderRadius } = styles;
const computedStyles = {
backgroundColor,
height,
display: visibility ? 'flex' : 'none',
borderRadius: borderRadius ? parseFloat(borderRadius) : 0,
};
const parentRef = useRef(null);
return (
<div
data-disabled={disabledState}
className="jet-container"
id={id}
ref={parentRef}
style={computedStyles}
onClick={(e) => {
if (e.target.className === 'real-canvas') containerProps.onComponentClick(id, component);
}} //Hack, should find a better solution - to prevent losing z index when comtainer element is clicked
>
<SubContainer
parentComponent={component}
containerCanvasWidth={width}
parent={id}
{...containerProps}
parentRef={parentRef}
removeComponent={removeComponent}
/>
<SubCustomDragLayer
containerCanvasWidth={width}
parent={id}
parentRef={parentRef}
currentLayout={containerProps.currentLayout}
/>
</div>
);
};