Skip to content

Commit 7291d6a

Browse files
authored
fix commit lines alignment (#8133)
* Update CommitLine.svelte * fix indicator animation * fix branch header icon inner alignment * Update BranchHeader.svelte * fix: last upstream commit detection
1 parent ab725a4 commit 7291d6a

File tree

5 files changed

+42
-40
lines changed

5 files changed

+42
-40
lines changed

apps/desktop/src/components/v3/BranchHeader.svelte

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import { TestId } from '$lib/testing/testIds';
88
import { inject } from '@gitbutler/shared/context';
99
import Icon from '@gitbutler/ui/Icon.svelte';
10+
import { slide } from 'svelte/transition';
1011
import type iconsJson from '@gitbutler/ui/data/icons.json';
1112
import type { Snippet } from 'svelte';
1213
@@ -94,6 +95,10 @@
9495
tabindex="0"
9596
class:activated={args.isMenuOpenByMouse || args.isMenuOpenByBtn}
9697
>
98+
{#if args.selected}
99+
<div class="branch-header__select-indicator" in:slide={{ axis: 'x', duration: 150 }}></div>
100+
{/if}
101+
97102
<BranchHeaderIcon
98103
{lineColor}
99104
{iconName}
@@ -188,19 +193,6 @@
188193
border-bottom: 1px solid var(--clr-border-2);
189194
overflow: hidden;
190195
191-
&:before {
192-
content: '';
193-
position: absolute;
194-
top: 14px;
195-
left: 0;
196-
width: 4px;
197-
height: 20px;
198-
transform: translateX(-100%);
199-
border-radius: 0 var(--radius-ml) var(--radius-ml) 0;
200-
background-color: var(--clr-selected-in-focus-element);
201-
transition: transform var(--transition-fast);
202-
}
203-
204196
&:hover,
205197
&.activated {
206198
background-color: var(--clr-bg-1-muted);
@@ -217,10 +209,6 @@
217209
& .branch-menu-btn {
218210
display: flex;
219211
}
220-
221-
&:before {
222-
transform: translateX(0%);
223-
}
224212
}
225213
226214
&:focus-within.selected {
@@ -236,6 +224,17 @@
236224
}
237225
}
238226
227+
.branch-header__select-indicator {
228+
position: absolute;
229+
top: 14px;
230+
left: 0;
231+
width: 4px;
232+
height: 20px;
233+
border-radius: 0 var(--radius-ml) var(--radius-ml) 0;
234+
background-color: var(--clr-selected-in-focus-element);
235+
transition: transform var(--transition-fast);
236+
}
237+
239238
.name-line {
240239
display: flex;
241240
align-items: center;

apps/desktop/src/components/v3/BranchHeaderIcon.svelte

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@
3030

3131
<style>
3232
.stack__status {
33+
flex: 0 0 auto;
3334
align-self: stretch;
3435
display: flex;
3536
flex-direction: column;
3637
justify-content: center;
3738
gap: 3px;
39+
width: 42px;
3840
--clr-transparent: transparent;
3941
4042
& .stack__status--icon {
@@ -46,13 +48,13 @@
4648
border-radius: var(--radius-m);
4749
background-color: var(--bg-color);
4850
color: #fff;
49-
margin-left: 10px;
51+
margin: 0 auto;
5052
}
5153
5254
& .stack__status--bar {
5355
width: 2px;
5456
height: 8px;
55-
margin: 0 22px 0 20px;
57+
margin: 0 auto;
5658
background: var(--bg-color);
5759
5860
&.dashed {

apps/desktop/src/components/v3/BranchList.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
{branchName}
116116
{projectId}
117117
{first}
118-
lastCommit={lastCommit && !commit}
118+
lastCommit={lastCommit && localAndRemoteCommits.length === 0}
119119
{commit}
120120
{selected}
121121
onclick={() => {

apps/desktop/src/components/v3/CommitLine.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
width?: number;
1313
}
1414
15-
const { commit, lastCommit, lastBranch, width = 48 }: Props = $props();
15+
const { commit, lastCommit, lastBranch, width = 42 }: Props = $props();
1616
1717
const color = $derived(
1818
isLocalAndRemoteCommit(commit)
@@ -64,6 +64,7 @@
6464

6565
<style lang="postcss">
6666
.commit-lines {
67+
flex: 0 0 auto;
6768
display: flex;
6869
flex-direction: column;
6970
align-items: center;

apps/desktop/src/components/v3/CommitRow.svelte

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import ContextMenu from '@gitbutler/ui/ContextMenu.svelte';
1717
import Icon from '@gitbutler/ui/Icon.svelte';
1818
import { getTimeAgo } from '@gitbutler/ui/utils/timeAgo';
19+
import { slide } from 'svelte/transition';
1920
2021
type Props = {
2122
projectId: string;
@@ -107,7 +108,7 @@
107108
role="button"
108109
tabindex="0"
109110
aria-label="Commit row"
110-
class="commit-row__main"
111+
class="commit-row"
111112
class:menu-shown={isOpenedByKebabButton || isOpenedByMouse}
112113
class:first
113114
class:selected
@@ -157,6 +158,10 @@
157158
}
158159
: NON_DRAGGABLE}
159160
>
161+
{#if selected}
162+
<div class="commit-row__select-indicator" in:slide={{ axis: 'x', duration: 150 }}></div>
163+
{/if}
164+
160165
<CommitLine {commit} {lastCommit} {lastBranch} />
161166

162167
<div class="commit-content">
@@ -219,26 +224,13 @@
219224
/>
220225

221226
<style lang="postcss">
222-
.commit-row__main {
227+
.commit-row {
223228
position: relative;
224229
display: flex;
225230
width: 100%;
226231
overflow: hidden;
227232
transition: background-color var(--transition-fast);
228233
229-
&::before {
230-
content: '';
231-
position: absolute;
232-
top: 50%;
233-
left: 0;
234-
width: 4px;
235-
height: 45%;
236-
transform: translateX(-100%) translateY(-50%);
237-
border-radius: 0 var(--radius-ml) var(--radius-ml) 0;
238-
background-color: var(--clr-selected-in-focus-element);
239-
transition: transform var(--transition-fast);
240-
}
241-
242234
&:hover,
243235
&.menu-shown {
244236
background-color: var(--clr-bg-1-muted);
@@ -263,17 +255,25 @@
263255
& .commit-menu-btn {
264256
display: flex;
265257
}
266-
267-
&:before {
268-
transform: translateX(0%) translateY(-50%);
269-
}
270258
}
271259
272260
&:focus-within.selected {
273261
background-color: var(--clr-selected-in-focus-bg);
274262
}
275263
}
276264
265+
.commit-row__select-indicator {
266+
position: absolute;
267+
top: 50%;
268+
left: 0;
269+
width: 4px;
270+
height: 45%;
271+
transform: translateY(-50%);
272+
border-radius: 0 var(--radius-ml) var(--radius-ml) 0;
273+
background-color: var(--clr-selected-in-focus-element);
274+
transition: transform var(--transition-fast);
275+
}
276+
277277
.commit-content {
278278
display: flex;
279279
align-items: center;

0 commit comments

Comments
 (0)