Skip to content

Commit 44253df

Browse files
authored
Cut overflowing comparison table text (#2381)
1 parent 0efb75b commit 44253df

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

webview/src/plots/components/comparisonTable/ComparisonTable.test.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ jest.mock('../../../shared/components/dragDrop/currentTarget', () => {
4545
const { postMessage } = vsCodeApi
4646
const mockPostMessage = jest.mocked(postMessage)
4747

48-
const getPin = (element: HTMLElement) => within(element).getByRole('button')
48+
const getPin = (element: HTMLElement) =>
49+
// eslint-disable-next-line testing-library/no-node-access
50+
within(element?.parentElement || element).getByRole('button')
4951

5052
describe('ComparisonTable', () => {
5153
afterEach(() => {

webview/src/plots/components/comparisonTable/ComparisonTableHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const ComparisonTableHeader: React.FC<ComparisonTableHeaderProps> = ({
3434
className={styles.bullet}
3535
style={{ backgroundColor: displayColor }}
3636
/>
37-
{children}
37+
<span className={styles.headerText}>{children}</span>
3838
</div>
3939
)
4040
}

webview/src/plots/components/comparisonTable/ComparisonTableRow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const ComparisonTableRow: React.FC<ComparisonTableRowProps> = ({
4444
<div className={styles.rowPath}>
4545
<button className={styles.rowToggler} onClick={toggleIsShownState}>
4646
<Icon icon={isShown ? ChevronDown : ChevronRight} />
47-
{path}
47+
<span className={styles.pathText}>{path}</span>
4848
</button>
4949
<CopyButton value={path} className={styles.copyButton} />
5050
</div>

webview/src/plots/components/comparisonTable/styles.module.scss

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ $gap: 4px;
4848
}
4949
}
5050

51+
.headerText {
52+
max-width: calc(100% - 20px);
53+
overflow: hidden;
54+
text-overflow: ellipsis;
55+
white-space: nowrap;
56+
}
57+
5158
.bullet {
5259
display: block;
5360
width: $bullet-size;
@@ -95,6 +102,7 @@ $gap: 4px;
95102
text-align: left;
96103
display: flex;
97104
user-select: text;
105+
width: 100%;
98106

99107
svg {
100108
fill: $fg-color;
@@ -182,9 +190,17 @@ $gap: 4px;
182190
display: flex;
183191
justify-content: flex-start;
184192
align-items: center;
193+
width: 100%;
185194

186195
&:hover .copyButton {
187196
display: inline;
188197
font-size: 0.8125rem;
189198
}
190199
}
200+
201+
.pathText {
202+
overflow: hidden;
203+
text-overflow: ellipsis;
204+
width: 100%;
205+
direction: rtl;
206+
}

0 commit comments

Comments
 (0)