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) {
|
if (hasFixedChild) {
|
||||||
return (
|
return (
|
||||||
<div className="flex h-full w-full flex-col">
|
<div className="flex h-full w-full flex-col">
|
||||||
{node.children.map((child) => {
|
{node.children.map((child) => {
|
||||||
const fixed = getFixedHeight(child.node, registry);
|
const fixed = getFixedHeight(child.node, registry);
|
||||||
|
const fit = child.node.type === 'panel' && child.node.fitContent;
|
||||||
return (
|
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
|
<LayoutNodeRenderer
|
||||||
node={child.node}
|
node={child.node}
|
||||||
registry={registry}
|
registry={registry}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export type LayoutPanel = {
|
|||||||
type: 'panel';
|
type: 'panel';
|
||||||
id: string;
|
id: string;
|
||||||
appType: string | null;
|
appType: string | null;
|
||||||
|
fitContent?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type LayoutNode = LayoutGroup | LayoutPanel;
|
export type LayoutNode = LayoutGroup | LayoutPanel;
|
||||||
|
|||||||
Reference in New Issue
Block a user