add fitContent option to workspace layout panels
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -164,15 +164,18 @@ const LayoutNodeRenderer = ({
|
||||
);
|
||||
}
|
||||
|
||||
const hasFixedChild = node.direction === 'vertical' && node.children.some((c) => getFixedHeight(c.node, registry) !== undefined);
|
||||
const hasFixedChild =
|
||||
node.direction === 'vertical' &&
|
||||
node.children.some((c) => getFixedHeight(c.node, registry) !== undefined || (c.node.type === 'panel' && c.node.fitContent));
|
||||
|
||||
if (hasFixedChild) {
|
||||
return (
|
||||
<div className="flex h-full w-full flex-col">
|
||||
{node.children.map((child) => {
|
||||
const fixed = getFixedHeight(child.node, registry);
|
||||
const fit = child.node.type === 'panel' && child.node.fitContent;
|
||||
return (
|
||||
<div key={child.node.id} className={fixed !== undefined ? 'shrink-0' : 'min-h-0 flex-1'} style={fixed !== undefined ? { height: fixed } : undefined}>
|
||||
<div key={child.node.id} className={fixed !== undefined || fit ? 'shrink-0' : 'min-h-0 flex-1'} style={fixed !== undefined ? { height: fixed } : undefined}>
|
||||
<LayoutNodeRenderer
|
||||
node={child.node}
|
||||
registry={registry}
|
||||
|
||||
@@ -12,6 +12,7 @@ export type LayoutPanel = {
|
||||
type: 'panel';
|
||||
id: string;
|
||||
appType: string | null;
|
||||
fitContent?: boolean;
|
||||
};
|
||||
|
||||
export type LayoutNode = LayoutGroup | LayoutPanel;
|
||||
|
||||
Reference in New Issue
Block a user