Skip to content

Commit 9f0b5b7

Browse files
committed
Introduce extraPaddingLeft to Element
1 parent 632e085 commit 9f0b5b7

File tree

1 file changed

+5
-2
lines changed
  • packages/compass-components/src/components/document-list

1 file changed

+5
-2
lines changed

packages/compass-components/src/components/document-list/element.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,13 +399,15 @@ export const HadronElement: React.FunctionComponent<{
399399
value: HadronElementType;
400400
editable: boolean;
401401
editingEnabled: boolean;
402+
extraPaddingLeft?: number;
402403
onEditStart?: (id: string, field: 'key' | 'value' | 'type') => void;
403404
lineNumberSize: number;
404405
onAddElement(el: HadronElementType): void;
405406
}> = ({
406407
value: element,
407408
editable,
408409
editingEnabled,
410+
extraPaddingLeft = 0,
409411
onEditStart,
410412
lineNumberSize,
411413
onAddElement,
@@ -445,8 +447,8 @@ export const HadronElement: React.FunctionComponent<{
445447
}, [lineNumberSize, editingEnabled]);
446448

447449
const elementSpacerWidth = useMemo(
448-
() => calculateElementSpacerWidth(editable, level),
449-
[editable, level]
450+
() => calculateElementSpacerWidth(editable, level) + extraPaddingLeft,
451+
[editable, level, extraPaddingLeft]
450452
);
451453

452454
// To render the "Show more" toggle for the nested expandable elements we need
@@ -711,6 +713,7 @@ export const HadronElement: React.FunctionComponent<{
711713
onEditStart={onEditStart}
712714
lineNumberSize={lineNumberSize}
713715
onAddElement={onAddElement}
716+
extraPaddingLeft={extraPaddingLeft}
714717
></HadronElement>
715718
);
716719
})}

0 commit comments

Comments
 (0)