<script lang="ts">
	import type { ShuntData } from '$lib/client';

	export let data: ShuntData;
</script>

<div class="shunt-content">
	<h2><b>Shunt Status</b></h2>

	<div class="log-collumn">
		<div class="log-entry">
			<div>Current:</div>
			<div><b>{data.current.toFixed(1)} A</b></div>
		</div>
	</div>
	<div class="log-collumn">
		<div class="log-entry">
			<div>Voltage Accu:</div>
			<div><b>{data.voltage1.toFixed(2)} V</b></div>
		</div>
	</div>
	<div class="log-collumn">
		<div class="log-entry">
			<div>Voltage Vehicle:</div>
			<div><b>{data.voltage2.toFixed(2)} V</b></div>
		</div>
	</div>
</div>

<style>
	.shunt-content {
		display: flex;
		flex-direction: column;
		width: 12vw;
		padding: 2px;
		margin: 2px;
		border: 2px solid black;
		font-size: 14px;
		margin-top: 10px;
		background-color: hsl(0, 60%, var(--lightness));
	}

	.log-entry {
		display: grid;
		grid-template-columns: 5fr 3fr;
		margin: 2px;
		padding: 2px;
		background-color: hsl(var(--hue), 80%, 80%);
	}

	.log-collumn {
		display: flex;
		flex-direction: column;
		background-color: hsl(0, 60%, var(--lightness));
	}

	h2 {
		text-align: center;
	}
</style>
