dev1/src/components/ReadinessPill.js
2025-06-26 15:43:49 +00:00

27 lines
739 B
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React from "react";
import InfoTooltip from "./ui/infoTooltip.js";
/**
* Compact badge that shows a 0-100 “readiness” score.
*
* Props:
* • score (Number 0-100)required
*/
export default function ReadinessPill({ score = 0 }) {
const pct = Math.max(0, Math.min(100, Math.round(score)));
const bg =
pct >= 80 ? "bg-green-600"
: pct >= 60 ? "bg-yellow-500"
: "bg-red-600";
return (
<span
className={`ml-2 inline-flex items-center gap-1 rounded-full px-2 py-px text-xs font-semibold text-white ${bg}`}
>
{pct}
<InfoTooltip message="How long your portfolio can fund your desired spending, mapped onto a 30-year scale (100 ≈ ≥30 yrs)" />
</span>
);
}