I have a popover inside which there are Colors components with different colors. Also there is a icon DoneIcon which (for time being) is placed inside the Colors component. What I'm trying to achieve is:
- After hovering when I select a color(with no icon inside),
DoneIconshould be placed inside it. To generalize when a color is selected it should haveDoneIconand the icon should disappear from the previously selected color. - When the color is selected the background color of (its parent)
divwithclass="box"should change to the selected color. I know this can be achieved with event handling by having functions for each color(out of 12 colors) which will be executedonClick, but how can I have only one function which will detect the color fromprops.colorwhenonClickevent executes and apply the color tobox.
Here is the link for CodeSandbox