({
name,
color,
index,
uniqKey,
setCustomColor,
deleteCustomColor,
setCustomName,
}: {
name: string;
color: string;
uniqKey: string;
index: number;
setCustomColor: (key: string, hex: string) => void;
deleteCustomColor: (key: string) => void;
setCustomName: (key: string, name: string) => void;
})
| 244 | }; |
| 245 | |
| 246 | const CustomColor = ({ |
| 247 | name, |
| 248 | color, |
| 249 | index, |
| 250 | uniqKey, |
| 251 | setCustomColor, |
| 252 | deleteCustomColor, |
| 253 | setCustomName, |
| 254 | }: { |
| 255 | name: string; |
| 256 | color: string; |
| 257 | uniqKey: string; |
| 258 | index: number; |
| 259 | setCustomColor: (key: string, hex: string) => void; |
| 260 | deleteCustomColor: (key: string) => void; |
| 261 | setCustomName: (key: string, name: string) => void; |
| 262 | }) => { |
| 263 | // const [colorName, setColorName] = useState<string>(name); |
| 264 | |
| 265 | const onNameChange = (event: React.ChangeEvent<HTMLInputElement>) => { |
| 266 | event.preventDefault(); |
| 267 | setCustomName(uniqKey, event.target.value); |
| 268 | }; |
| 269 | |
| 270 | if (name) { |
| 271 | return ( |
| 272 | <tr> |
| 273 | <td> |
| 274 | Custom color #{index + 1}:{' '} |
| 275 | <input |
| 276 | value={name} |
| 277 | onChange={onNameChange} |
| 278 | className="color-picker-name-input" |
| 279 | /> |
| 280 | </td> |
| 281 | <td> |
| 282 | <ColorPicker |
| 283 | color={color} |
| 284 | setColor={(hex) => setCustomColor(uniqKey, hex)} |
| 285 | additional |
| 286 | /> |
| 287 | <button |
| 288 | className="color-picker-button-cancel" |
| 289 | onClick={() => deleteCustomColor(uniqKey)} |
| 290 | > |
| 291 | ✕ |
| 292 | </button> |
| 293 | </td> |
| 294 | </tr> |
| 295 | ); |
| 296 | } |
| 297 | |
| 298 | return ( |
| 299 | <tr> |
| 300 | <td colSpan={2}> |
| 301 | Custom color #{index + 1}:{' '} |
| 302 | <input |
| 303 | value={name} |
nothing calls this directly
no test coverage detected
searching dependent graphs…