Debian Codegraph @

frontend/src/tree-table/Diff.svelte

raw
1 <script lang="ts">
2 import { ctx } from "../stores/format";
3
4 interface Props {
5 /** Difference to show. */
6 diff: number;
7 /** Number to show on hover. */
8 num: number;
9 /** The currency that both numbers are in. */
10 currency: string;
11 }
12
13 let { diff, num, currency }: Props = $props();
14 </script>
15
16 <br />
17 <span class:positive={diff > 0} title={$ctx.amount(num, currency)}>
18 ({$ctx.num(diff, currency)})
19 </span>
20
21 <style>
22 span {
23 margin-right: 3px;
24 font-size: 0.9em;
25 color: var(--budget-negative);
26 white-space: nowrap;
27 }
28
29 .positive {
30 color: var(--budget-positive);
31 }
32 </style>