mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-25 21:00:28 -05:00
18 lines
488 B
TypeScript
18 lines
488 B
TypeScript
import { roundToNDecimalPlaces } from "~/utils/number";
|
|
|
|
/** SP change as a colored arrow (none for zero) and the size; place in a flex/grid container spacing the two. */
|
|
export function SpDelta({ diff }: { diff: number }) {
|
|
const rounded = roundToNDecimalPlaces(diff);
|
|
|
|
return (
|
|
<>
|
|
{rounded === 0 ? null : (
|
|
<span className={rounded > 0 ? "text-success" : "text-warning"}>
|
|
{rounded > 0 ? "▲" : "▼"}
|
|
</span>
|
|
)}
|
|
<span>{Math.abs(rounded)}SP</span>
|
|
</>
|
|
);
|
|
}
|