zhammer / morning-cd

What was the first piece of music you listened to this morning?
MIT License
4 stars 0 forks source link

Don't delay animation to white text on listens page if starting at night #107

Open zhammer opened 5 years ago

zhammer commented 5 years ago

Right now there's a 5 second delay in starting the glowing text animation for listens text at night. This is because we're waiting for the full page to transition to night, and once that transition is done we start glowing to white.

If the page loads directly to night, however, the text just stays gray for a while. It should start glowing immediately.

This will probably just involve checking if it's night && if it's the first render? not 100% sure best way to do this

https://github.com/zhammer/morning-cd/blob/046efe1c07929d1994f43c37eee64e94b2279b0c/web_client/src/scenes/ListensPage/Listen/Listen.styles.tsx#L24

zhammer commented 5 years ago
const isFirstRender = useFirstRender();
const animationDelay = useMemo(() => {
  if (isFirstRender && isDay) {
    return 0;
  }
  return 5;
}, [isDay]);