pad string to a fixed length to stop shifting

pull/34/head
Ben Phelps 2 years ago
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>

Loading…
Cancel
Save