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
Liam 671f520635
Some checks failed
Deploy SSR / deploy (push) Failing after 30s
change theme color (again) and add acc colors to the score stat badges
2024-09-13 14:22:51 +01:00

43 lines
847 B
TypeScript

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