refactored infoCardControls code for state change when clicked