import clsx from "clsx"; import { AnimatePresence, motion } from "framer-motion"; import * as React from "react"; import { usePrevious } from "react-use"; import CheckCircle from "@/components/icons/check-circle.svg"; import IfNeedBe from "@/components/icons/if-need-be.svg"; export interface PopularityScoreProps { yesScore: number; compact?: boolean; ifNeedBeScore?: number; highlight?: boolean; } const Score = React.forwardRef< HTMLDivElement, { icon: React.ComponentType<{ className?: string }>; score: number; compact?: boolean; } >(function Score({ icon: Icon, score, compact }, ref) { const prevScore = usePrevious(score); const multiplier = prevScore !== undefined ? score - prevScore : 0; return (
{score} {/* Invisible text just to give us the right width */} {score}
); }); const MotionScore = motion(Score); export const ScoreSummary: React.VoidFunctionComponent = React.memo(function PopularityScore({ yesScore, ifNeedBeScore, compact }) { return (
{ifNeedBeScore ? ( ) : null}
); });