I'd give them practical advise and do whatever I could to attempt to remedy the situation. If nothing happened. I'd just sit with them and spend time with them until they forgot whatever was making them feel sad o got better overall.
I would normally talk a bunch with them, get them to spill all their troubles and thoughts so we're on the same page, then I'll give them the best consejos I can offer.
If they're online, then I'll spam them with things they love. If they're in person I'll just give them a long hug and comfort them until they feel better. Then we'd chromecast youtube together to just chill out a bit.
do my pest to comfort them sometimes is better to leave them alone... to be honest for me personally when i get sad i prefer to be alone its faster for me to get over it this way without anyone interfering,it actually gives me time to relax and think straight