~ knotless Search/
↑↓ move↵ open⇧↵ all results

johnandersen777.bsky.social/knotless

git that lives in your Atmosphere account

Forked from chadtmiller.com/knotless

0
0
13 lines · 553 B Raw History
<script lang="ts">
	/** Five squares, filled in proportion to what a file gained and lost. */
	let { added, removed }: { added: number; removed: number } = $props();
	const total = $derived(added + removed);
	const share = (n: number) => (total ? Math.floor((n * 5 + Math.floor(total / 2)) / total) : 0);
	const a = $derived(share(added));
	const d = $derived(Math.min(share(removed), 5 - a));
</script>

<span class="bars" aria-hidden="true"
	>{#each [0, 1, 2, 3, 4] as i (i)}<i class={i < a ? 'a' : i < a + d ? 'd' : undefined}
		></i>{/each}</span
>