"use client";
import { Skeleton } from "@pythnetwork/component-library/Skeleton";
import { Meter } from "@pythnetwork/component-library/unstyled/Meter";
import type { CSSProperties } from "react";
import styles from "./index.module.scss";
const SCORE_WIDTH = 24;
type Props = {
width?: number | undefined;
fill?: boolean | undefined;
} & (
| { isLoading: true }
| {
isLoading?: false;
score: number;
}
);
export const Score = ({ width, fill, ...props }: Props) =>
props.isLoading ? (
) : (
{({ percentage }) => (
)}
);
const getSizeClass = (percentage: number) => {
if (percentage < 60) {
return "bad";
} else if (percentage < 70) {
return "weak";
} else if (percentage < 80) {
return "warn";
} else if (percentage < 90) {
return "ok";
} else {
return "good";
}
};