Horrible if true. But as far as I understand, it would be not illegal since the president as commander-in-chief is permitted to declassify secret information. Even if it’s politically very unprofessional and stupid. But I wouldn’t be surprised at all. Drumpf has proven several times that he has no competence and is in no ways up to the job.
It may be legal, but as Brittain33 noted, it certainly is potentially impeachable. I am not saying this incident deserves impeachment, but suppose, to posit an extreme hypothetical, Trump gave to N. Korea the US nuclear codes or something? He'd be out the door in a hurry.