import React, { useState } from "react"; import check from "../../assests/checkBox.png"; import { themeColor } from "../../utils/ThemeColor/backColor"; import "../../css/signerListPlace.css"; function SignerListPlace({ signerPos, signersdata, isSelectListId, setSignerObjId, setIsSelectId, setContractName, handleAddSigner, setUniqueId, setRoleName, handleDeleteUser, handleRoleChange }) { const color = [ "#93a3db", "#e6c3db", "#c0e3bc", "#bce3db", "#b8ccdb", "#ceb8db", "#ffccff", "#99ffcc", "#cc99ff", "#ffcc99", "#66ccff", "#ffffcc" ]; const nameColor = [ "#304fbf", "#7d5270", "#5f825b", "#578077", "#576e80", "#6d527d", "#cc00cc", "#006666", "#cc00ff", "#ff9900", "#336699", "#cc9900" ]; const [isHover, setIsHover] = useState(); //function for onhover signer name change background color const onHoverStyle = (ind) => { const style = { background: color[ind % color.length], padding: "10px", marginTop: "2px", display: "flex", flexDirection: "row", borderBottom: "1px solid #e3e1e1" }; return style; }; //function for onhover signer name remove background color const nonHoverStyle = (ind) => { const style = { // width:"250px", padding: "10px", marginTop: "2px", display: "flex", flexDirection: "row", borderBottom: "1px solid #e3e1e1", justifyContent: "space-between" }; return style; }; const getFirstLetter = (name) => { const firstLetter = name?.charAt(0); return firstLetter; }; return (
Reicipents
<> {signersdata.length > 0 && signersdata.map((obj, ind) => { return (
setIsHover(ind)} onMouseLeave={() => setIsHover(null)} key={ind} style={ isHover === ind || isSelectListId === ind ? onHoverStyle(ind) : nonHoverStyle(ind) } onClick={() => { setSignerObjId(obj?.objectId); setIsSelectId(ind); setContractName(obj?.className); setUniqueId(obj.Id); setRoleName(obj.Role); }} >
{obj.Name ? getFirstLetter(obj.Name) : getFirstLetter(obj.Role)}
{obj.Name ? ( {obj.Name} ) : ( <> {handleRoleChange ? ( handleRoleChange(e, obj.Id)} > {obj.Role} ) : ( {obj.Role} )} )} {obj.Email && ( {obj.Email} )}
{handleDeleteUser && (
{ e.stopPropagation(); handleDeleteUser(obj.Id); }} style={{ cursor: "pointer" }} >
)} {signerPos.map((data, key) => { return ( data.Id === obj.Id && (
no img
) ); })}
); })}
{handleAddSigner && (
handleAddSigner()}> Add
)}
); } export default SignerListPlace;