This repository has been archived on 2024-10-29. You can view files and clone it, but cannot push or open issues or pull requests.
scoresaber-reloadedv3/src/components/stat-value.tsx

43 lines
847 B
TypeScript
Raw Normal View History

import clsx from "clsx";
2024-09-12 18:09:54 +00:00
type Props = {
/**
* The stat name.
*/
name?: string;
2024-09-12 18:09:54 +00:00
/**
* The background color of the stat.
*/
color?: string;
2024-09-12 18:09:54 +00:00
/**
* The value of the stat.
*/
value: React.ReactNode;
};
2024-09-12 18:09:54 +00:00
export default function StatValue({ name, color, value }: Props) {
return (
2024-09-12 18:09:54 +00:00
<div
className={clsx(
"flex min-w-16 gap-2 h-[28px] p-1 items-center justify-center rounded-md text-sm",
2024-09-13 12:45:04 +00:00
color ? color : "bg-accent",
2024-09-12 18:09:54 +00:00
)}
style={{
backgroundColor: (!color?.includes("bg") && color) || undefined,
}}
2024-09-12 18:09:54 +00:00
>
{name && (
<>
<p>{name}</p>
<div className="h-4 w-[1px] bg-primary" />
</>
)}
2024-09-13 12:45:04 +00:00
<div className="flex gap-1 items-center">
{typeof value === "string" ? <p>{value}</p> : value}
</div>
</div>
);
}