Skip to content

Commit

Permalink
fix widget height
Browse files Browse the repository at this point in the history
  • Loading branch information
MrWangJustToDo committed Jan 19, 2024
1 parent b0de118 commit 368d5b4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
4 changes: 3 additions & 1 deletion packages/react/src/components/DiffSplitExtendLine.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ const _DiffSplitExtendLine = ({ index, diffFile, side, lineNumber }: { index: nu
>
<td className="diff-line-extend-content align-top p-[0]" colSpan={2}>
<div className="diff-line-extend-wrapper sticky left-0" style={{ width }}>
{currentExtend && renderExtendLine({ diffFile, side, lineNumber: currentExtend.lineNumber, data: currentExtend.data, onUpdate: diffFile.notifyAll })}
{width > 0 &&
currentExtend &&
renderExtendLine({ diffFile, side, lineNumber: currentExtend.lineNumber, data: currentExtend.data, onUpdate: diffFile.notifyAll })}
</div>
</td>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/DiffSplitWidgetLine.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const _DiffSplitWidgetLine = ({ index, diffFile, side, lineNumber }: { index: nu
>
<td className="diff-line-widget-content p-0" colSpan={2}>
<div className="diff-line-widget-wrapper sticky left-0" style={{ width }}>
{currentWidget && renderAddWidget?.({ diffFile, side, lineNumber: currentItem.lineNumber, onClose: diffFile.onCloseAddWidget })}
{width > 0 && currentWidget && renderAddWidget?.({ diffFile, side, lineNumber: currentItem.lineNumber, onClose: diffFile.onCloseAddWidget })}
</div>
</td>
</tr>
Expand Down
6 changes: 4 additions & 2 deletions packages/react/src/components/DiffUnifiedExtendLine.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ const _DiffUnifiedExtendLine = ({ index, diffFile, lineNumber }: { index: number
<tr data-line={`${lineNumber}-extend`} data-state="extend" className="diff-line diff-line-extend">
<td className="diff-line-extend-content align-top p-[0]" colSpan={4}>
<div className="diff-line-extend-wrapper sticky left-0" style={{ width }}>
{oldExtend &&
{width > 0 &&
oldExtend &&
renderExtendLine({ diffFile, side: SplitSide.old, lineNumber: oldExtend.lineNumber, data: oldExtend.data, onUpdate: diffFile.notifyAll })}
{newExtend &&
{width > 0 &&
newExtend &&
renderExtendLine({ diffFile, side: SplitSide.new, lineNumber: newExtend.lineNumber, data: newExtend.data, onUpdate: diffFile.notifyAll })}
</div>
</td>
Expand Down
8 changes: 6 additions & 2 deletions packages/react/src/components/DiffUnifiedWidgetLine.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@ const _DiffUnifiedWidgetLine = ({ index, diffFile }: { index: number; diffFile:
<tr data-state="widget" className="diff-line diff-line-widget">
<td className="diff-line-widget-content p-0" colSpan={4}>
<div className="diff-line-widget-wrapper sticky left-0" style={{ width }}>
{oldWidget && renderAddWidget?.({ diffFile, side: SplitSide.old, lineNumber: unifiedItem.oldLineNumber, onClose: diffFile.onCloseAddWidget })}
{newWidget && renderAddWidget?.({ diffFile, side: SplitSide.new, lineNumber: unifiedItem.newLineNumber, onClose: diffFile.onCloseAddWidget })}
{width > 0 &&
oldWidget &&
renderAddWidget?.({ diffFile, side: SplitSide.old, lineNumber: unifiedItem.oldLineNumber, onClose: diffFile.onCloseAddWidget })}
{width > 0 &&
newWidget &&
renderAddWidget?.({ diffFile, side: SplitSide.new, lineNumber: unifiedItem.newLineNumber, onClose: diffFile.onCloseAddWidget })}
</div>
</td>
</tr>
Expand Down

0 comments on commit 368d5b4

Please sign in to comment.