import React from "react"; import PropTypes from "prop-types"; import { COLOR_LIST } from "../../constants"; const BgColor = (props) => { const renderColor = () => { return COLOR_LIST.map((bgColor) => { const selected = bgColor.name === props.bgColor ? " selected" : ""; const divStyle = { backgroundColor: bgColor.color }; return (
props.handleColorClick(e, bgColor.name)} key={bgColor.id} >
{selected && (
)}
); }); }; return <>{renderColor()}; }; BgColor.propTypes = { bgColor: PropTypes.string, handleColorClick: PropTypes.func, }; export default BgColor;