Skip to content

Commit a82c627

Browse files
committed
Add styling for patch diff stats
1 parent 608d211 commit a82c627

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

src/components/DiffStatBadge.svelte

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<script lang="ts">
2+
import type { Stats } from "@bindings/Stats";
3+
4+
export let stats: Stats;
5+
</script>
6+
7+
<style>
8+
.diff-stat-badge {
9+
display: flex;
10+
clip-path: var(--1px-corner-fill);
11+
height: 1.5rem;
12+
}
13+
14+
.insertions {
15+
display: flex;
16+
padding: 0 0.5rem;
17+
align-items: center;
18+
color: var(--color-foreground-success);
19+
background-color: var(--color-fill-diff-green-light);
20+
}
21+
.deletions {
22+
display: flex;
23+
padding: 0 0.5rem;
24+
align-items: center;
25+
color: var(--color-foreground-red);
26+
background-color: var(--color-fill-diff-red-light);
27+
}
28+
</style>
29+
30+
<div class="diff-stat-badge txt-mono txt-semibold txt-small">
31+
<div class="insertions">+{stats.insertions}</div>
32+
<div class="deletions">-{stats.deletions}</div>
33+
</div>

src/components/PatchTeaser.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import { formatOid, formatTimestamp } from "@app/lib/utils";
66
import { invoke } from "@tauri-apps/api/core";
77
8+
import DiffStatBadge from "./DiffStatBadge.svelte";
89
import Icon from "./Icon.svelte";
910
import InlineTitle from "./InlineTitle.svelte";
1011
import NodeId from "./NodeId.svelte";
@@ -82,7 +83,7 @@
8283
</div>
8384
<div class="global-flex">
8485
{#await invoke<Stats>( "diff", { rid, base: patch.base, head: patch.head }, ) then stats}
85-
<div>{stats.insertions} / {stats.deletions}</div>
86+
<DiffStatBadge {stats} />
8687
{/await}
8788
{#each patch.labels as label}
8889
<div class="global-counter txt-small">{label}</div>

0 commit comments

Comments
 (0)