Skip to content

Commit b5a13e3

Browse files
authored
Reduce some padding in sidebar (#7607)
* Reduce some padding in sidebar Part of #7383 * Better guess for whether labels will fit
1 parent 8d7ebad commit b5a13e3

2 files changed

Lines changed: 14 additions & 9 deletions

File tree

webviews/components/sidebar.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ export function CollapsibleSidebar(props: PullRequest) {
240240
return (
241241
<div className="collapsible-sidebar">
242242
<div
243-
className="collapsible-sidebar-header"
243+
className={`collapsible-sidebar-header ${expanded ? 'expanded' : ''}`}
244244
onClick={() => setExpanded(e => !e)}
245245
tabIndex={0}
246246
role="button"
@@ -298,11 +298,13 @@ function CollapsedLabel(props: PullRequest) {
298298

299299
// Start with all items and reduce until they fit
300300
let testCount = items.length;
301+
let characterCount = items.reduce((acc, item) => acc + getText(item).length, 0);
301302
while (testCount > 0) {
302-
const testWidth = testCount * 50 + (testCount < items.length ? overflowTextWidth : 0);
303+
const testWidth = ((characterCount * 6) + (14 * testCount)) + (testCount < items.length ? overflowTextWidth : 0);
303304
if (testWidth <= containerWidth) {
304305
break;
305306
}
307+
characterCount -= getText(items[testCount - 1]).length;
306308
testCount--;
307309
}
308310

@@ -335,7 +337,7 @@ function CollapsedLabel(props: PullRequest) {
335337
);
336338
})}
337339
{hiddenCount > 0 && (
338-
<span className="pill-overflow">+{hiddenCount}</span>
340+
<span className="pill-overflow">+{hiddenCount} more</span>
339341
)}
340342
</span>;
341343
};

webviews/editorWebview/index.css

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -608,11 +608,11 @@ small-button {
608608
}
609609

610610
.section {
611-
padding-bottom: 24px;
611+
padding-bottom: 14px;
612612
border-bottom: 1px solid var(--vscode-editorWidget-border);
613613
display: flex;
614614
flex-direction: column;
615-
gap: 12px;
615+
gap: 8px;
616616
}
617617

618618
.section:last-of-type {
@@ -1487,22 +1487,26 @@ svg.octicon path {
14871487
display: flex;
14881488
align-items: center;
14891489
cursor: pointer;
1490-
padding: 16px 8px 7px;
1490+
padding: 16px 0px 7px;
14911491
user-select: none;
14921492
outline: none;
14931493
}
14941494

1495+
.collapsible-sidebar-header.expanded {
1496+
padding: 7px 0px;
1497+
}
1498+
14951499
.collapsible-sidebar-header:focus {
14961500
outline: 1px solid var(--vscode-focusBorder);
14971501
}
14981502

14991503
.collapsible-sidebar-title {
1500-
font-size: 14px;
1504+
font-size: 13px;
15011505
width: 100%;
15021506
}
15031507

15041508
.collapsible-sidebar-content {
1505-
padding: 6px 22px;
1509+
padding-bottom: 6px;
15061510
}
15071511

15081512
.collapsed-label {
@@ -1587,7 +1591,6 @@ svg.octicon path {
15871591
}
15881592

15891593
.collapsible-label-see-more {
1590-
padding-left: 8px;
15911594
padding-bottom: 8px;
15921595
display: block;
15931596
font-size: 12px;

0 commit comments

Comments
 (0)