Skip to content

Commit b4394c4

Browse files
committed
Updates home spacing and layout
1 parent 63ff906 commit b4394c4

File tree

4 files changed

+185
-199
lines changed

4 files changed

+185
-199
lines changed

src/webviews/apps/plus/home/components/active-work.ts

Lines changed: 37 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type { GitTrackingState } from '../../../../../git/models/branch';
88
import { createWebviewCommandLink } from '../../../../../system/webview';
99
import type { GetOverviewBranch, State } from '../../../../home/protocol';
1010
import { stateContext } from '../../../home/context';
11-
import { branchCardStyles, createCommandLink, sectionHeadingStyles } from './branch-section';
11+
import { branchCardStyles, createCommandLink } from './branch-section';
1212
import type { Overview, OverviewState } from './overviewState';
1313
import { overviewStateContext } from './overviewState';
1414
import '../../../shared/components/button';
@@ -27,22 +27,16 @@ export const activeWorkTagName = 'gl-active-work';
2727
export class GlActiveWork extends SignalWatcher(LitElement) {
2828
static override styles = [
2929
branchCardStyles,
30-
sectionHeadingStyles,
3130
css`
3231
:host {
3332
display: block;
3433
margin-bottom: 2.4rem;
35-
}
36-
.is-end {
37-
margin-block-end: 0;
34+
color: var(--vscode-foreground);
3835
}
3936
.section-heading-action {
4037
--button-padding: 0.1rem 0.2rem 0;
4138
margin-block: -1rem;
4239
}
43-
.heading-icon {
44-
color: var(--color-foreground--50);
45-
}
4640
`,
4741
];
4842

@@ -76,8 +70,10 @@ export class GlActiveWork extends SignalWatcher(LitElement) {
7670
private renderPending() {
7771
if (this._overviewState.state == null) {
7872
return html`
79-
<h3 class="section-heading"><skeleton-loader lines="1"></skeleton-loader></h3>
80-
<skeleton-loader lines="3"></skeleton-loader>
73+
<gl-section>
74+
<skeleton-loader slot="heading" lines="1"></skeleton-loader>
75+
<skeleton-loader lines="3"></skeleton-loader>
76+
</gl-section>
8177
`;
8278
}
8379
return this.renderComplete(this._overviewState.state, true);
@@ -89,12 +85,14 @@ export class GlActiveWork extends SignalWatcher(LitElement) {
8985
if (!activeBranches) return html`<span>None</span>`;
9086

9187
return html`
92-
<h3 class="section-heading section-heading--actions">
93-
<span><code-icon icon="repo" class="heading-icon"></code-icon> ${overview!.repository.name}</span>
88+
<gl-section>
89+
<span slot="heading"
90+
><code-icon icon="repo" class="heading-icon"></code-icon> ${overview!.repository.name}</span
91+
>
9492
${when(
9593
this._homeState.repositories.openCount > 1,
9694
() =>
97-
html`<span
95+
html`<span slot="heading-actions"
9896
><gl-button
9997
aria-busy="${ifDefined(isFetching)}"
10098
?disabled=${isFetching}
@@ -105,32 +103,38 @@ export class GlActiveWork extends SignalWatcher(LitElement) {
105103
><code-icon icon="chevron-down"></code-icon></gl-button
106104
></span>`,
107105
)}
108-
</h3>
109-
${activeBranches.map(branch => this.renderRepoBranchCard(branch, repo.path, isFetching))}
106+
${activeBranches.map(branch => this.renderRepoBranchCard(branch, repo.path, isFetching))}
107+
</gl-section>
110108
`;
111109
}
112110

113111
private renderRepoBranchCard(branch: GetOverviewBranch, repo: string, isFetching: boolean) {
114112
const { name, pr, state, workingTreeState, upstream } = branch;
115113
return html`
116114
<gl-card class="branch-item" active>
117-
<p class="branch-item__main">
118-
<span class="branch-item__icon">
119-
<code-icon icon=${branch.worktree ? 'gl-worktrees-view' : 'git-branch'}></code-icon>
120-
</span>
121-
<span class="branch-item__name">${name}</span>
122-
</p>
123-
${when(state, () => this.renderBranchStateActions(state, upstream, isFetching))}
124-
${when(pr, pr => {
125-
return html` <p class="branch-item__main is-end">
126-
<span class="branch-item__icon">
127-
<pr-icon state=${pr.state}></pr-icon>
128-
</span>
129-
<span class="branch-item__name">${pr.title}</span>
130-
<a href=${pr.url} class="branch-item__identifier">#${pr.id}</a>
131-
</p>`;
132-
})}
133-
${when(workingTreeState, () => this.renderStatus(workingTreeState, state))}
115+
<div class="branch-item__container">
116+
<div class="branch-item__section">
117+
<p class="branch-item__grouping">
118+
<span class="branch-item__icon">
119+
<code-icon icon=${branch.worktree ? 'gl-worktrees-view' : 'git-branch'}></code-icon>
120+
</span>
121+
<span class="branch-item__name">${name}</span>
122+
</p>
123+
</div>
124+
${when(state, () => this.renderBranchStateActions(state, upstream, isFetching))}
125+
${when(pr, pr => {
126+
return html`<div class="branch-item__section">
127+
<p class="branch-item__grouping">
128+
<span class="branch-item__icon">
129+
<pr-icon state=${pr.state}></pr-icon>
130+
</span>
131+
<span class="branch-item__name">${pr.title}</span>
132+
<a href=${pr.url} class="branch-item__identifier">#${pr.id}</a>
133+
</p>
134+
</div>`;
135+
})}
136+
${when(workingTreeState, () => this.renderStatus(workingTreeState, state))}
137+
</div>
134138
${this.renderActions(branch, repo)}
135139
</gl-card>
136140
`;
@@ -312,7 +316,7 @@ export class GlActiveWork extends SignalWatcher(LitElement) {
312316
// }
313317

314318
if (rendered.length) {
315-
return html`<p class="branch-item__details">${rendered}</p>`;
319+
return html`<p class="branch-item__section branch-item__section--details">${rendered}</p>`;
316320
}
317321

318322
return nothing;

0 commit comments

Comments
 (0)