// Generated with util/create-component.js import { motion } from "framer-motion"; import React from "react"; import Text from "../UI/Text"; import { ScoreProps } from "./Score.types"; const Score = ({ data, hidePriceScore = false }: ScoreProps) => { const scoreMetaMap = data ?? {}; const metaKeyList = Object.keys(scoreMetaMap); return (
{metaKeyList.map((key) => { const { score, name, label } = scoreMetaMap[`${key}`]; if ( score < 0 || (hidePriceScore && (key === "score_price" || name.includes("가격"))) ) { return; } return (
{name} {label}
); })}
); }; export default Score; const ScoreBar = ({ score }: { score: number }) => { let color; if (score < 2) { color = "#FF9900"; } else if (score < 3) { color = "#FFE14D"; } else if (score < 4) { color = "#06DB75"; } else if (score < 5) { color = "#36B7FF"; } else if (score === 5) { color = "#256FFF"; } return (
{score}
); };