File size: 754 Bytes
836dd88
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
export interface ISentimentDisplay {
  label: string;
  value: number;
}

export function SentimentDisplay({ label, value }: ISentimentDisplay) {
  const printed_percentage = (value * 100).toFixed(2).padStart(5, "0");
  const width_percentage = Math.max(value * 100, 2)
  return (
    <div className="flex flex-col gap-1.5">
      <div className="flex gap-3 items-baseline">
        <p className="capitalize font-medium">
          {label}
        </p>
        <p className="">
          {printed_percentage}%
        </p>
      </div>
      <div className="w-full">
        <div
          className="bg-gradient-to-r from-rose-400 to-rose-50 h-5 rounded-full"
          style={{ width: `${width_percentage}%` }}
        />
      </div>
    </div>
  )
}