- Center RO / Justify Alerts

- Prevent Height redraw in Vertical mode
- add default setting for model_info
- cleanup renderDroppable

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-07-09 16:52:23 -04:00
parent cdf7bcf839
commit 870878d151
5 changed files with 91 additions and 50 deletions

View File

@@ -6,10 +6,11 @@ import PropTypes from "prop-types";
* @param children
* @param maxHeight
* @param setMaxHeight
* @param override - Override the minHeight style from being set
* @returns {Element}
* @constructor
*/
const HeightMemoryWrapper = ({ children, maxHeight, setMaxHeight }) => {
const HeightMemoryWrapper = ({ children, maxHeight, setMaxHeight, override }) => {
const ref = useRef(null);
useEffect(() => {
@@ -33,8 +34,10 @@ const HeightMemoryWrapper = ({ children, maxHeight, setMaxHeight }) => {
};
}, [setMaxHeight]);
const style = override ? {} : { minHeight: maxHeight };
return (
<div ref={ref} style={{ minHeight: maxHeight }}>
<div ref={ref} style={style}>
{children}
</div>
);
@@ -43,7 +46,8 @@ const HeightMemoryWrapper = ({ children, maxHeight, setMaxHeight }) => {
HeightMemoryWrapper.propTypes = {
children: PropTypes.node.isRequired,
maxHeight: PropTypes.number.isRequired,
setMaxHeight: PropTypes.func.isRequired
setMaxHeight: PropTypes.func.isRequired,
override: PropTypes.bool
};
export default HeightMemoryWrapper;

View File

@@ -180,8 +180,11 @@ const Lane = ({
: {}
: componentProps;
return orientation === "horizontal" ? (
<HeightMemoryWrapper maxHeight={maxLaneHeight} setMaxHeight={setMaxLaneHeight}>
const shouldOverride = orientation !== "horizontal" && (collapsed || !renderedCards.length);
const shouldRenderPlaceholder = orientation !== "horizontal" && (collapsed || renderedCards.length === 0);
return (
<HeightMemoryWrapper maxHeight={maxLaneHeight} setMaxHeight={setMaxLaneHeight} override={shouldOverride}>
<div
{...provided.droppableProps}
ref={provided.innerRef}
@@ -189,18 +192,9 @@ const Lane = ({
style={{ ...provided.droppableProps.style }}
>
{isVisible && <FinalComponent {...finalComponentProps} />}
{shouldRenderPlaceholder && provided.placeholder}
</div>
</HeightMemoryWrapper>
) : (
<div
{...provided.droppableProps}
ref={provided.innerRef}
className={`react-trello-lane ${collapsed ? "lane-collapsed" : ""}`}
style={{ ...provided.droppableProps.style }}
>
{isVisible && <FinalComponent {...finalComponentProps} />}
{(collapsed || renderedCards.length === 0) && provided.placeholder}
</div>
);
},
[orientation, collapsed, isVisible, renderDraggable, maxLaneHeight, setMaxLaneHeight, maxCardWidth]