This article indicates the 18 States who passed laws to back the National popular vote is legal.
https://www.huffpost.com/entry/supreme-court-electoral-college_n_5f033201c5b612083c5f60d8?guccounter=1&guce_referrer=aHR0cHM6Ly90LmNvL1RQRDZZRkRwcXo_YW1wPTE&guce_referrer_sig=AQAAAFL_wBEQzwy5_y50COcQ01Hkb1sFwFYzjA35y5frmwWUnsJelT07h79AWCNYA9JUn5k1118TGDLtNKgV0Lyy0DJljMWnWxotKCd0azt9bLarRtIMdUKvaFW-QX-DlrezMV4_OyYP-7mEWP2JbptMjZfPsv3ItJRlWUcuHj231cu8