1
0
mirror of https://github.com/karl0ss/homepage.git synced 2025-05-29 00:35:06 +01:00

pad string to a fixed length to stop shifting

This commit is contained in:
Ben Phelps 2022-08-27 11:03:12 +03:00
parent f0f470ba8b
commit 086c767ed6

@ -35,9 +35,11 @@ export default function Cpu() {
<div className="flex-none flex flex-row items-center justify-center">
<FiCpu className="text-theme-800 dark:text-theme-200 w-5 h-5" />
<div className="flex flex-col ml-3 text-left font-mono">
<span className="text-theme-800 dark:text-theme-200 text-xs">{Math.round(data.cpu.usage)}% Usage</span>
<span className="text-theme-800 dark:text-theme-200 text-xs">
{(Math.round(data.cpu.load * 100) / 100).toFixed(1)} Load
<span className="whitespace-pre">{`${Math.round(data.cpu.usage)}%`.padEnd(3, " ")} Usage</span>
</span>
<span className="text-theme-800 dark:text-theme-200 text-xs">
{`${(Math.round(data.cpu.load * 100) / 100).toFixed(1)}`.padEnd(3, " ")} Load
</span>
</div>
</div>