3b1b / 3Blue1Brown.com

https://www.3blue1brown.com
Other
358 stars 137 forks source link

HomepageFeaturedItem Default Behavior #308

Closed kurtbruns closed 2 years ago

kurtbruns commented 2 years ago

Change the default behavior of the HomepageFeaturedItem component so that, in the case of a video, when no child item is provided, the default behavior is that the thumbnail is grabbed and used from youtube using the video ID.

For example, authoring a HomepageFeaturedItem like this:

<HomepageFeaturedItem lesson="visual-proofs" caption="Latest video: How to Lie with Visual Proofs">
</HomepageFeaturedItem>

Would result in behavior like what is shown below. Note, this is currently what I have hardcoded into the site for this lesson in the content/index.mdx file.

<HomepageFeaturedItem lesson="visual-proofs" caption="Latest video: How to Lie with Visual Proofs">
  <img src="https://img.youtube.com/vi/VYQVlVoWoPY/maxresdefault.jpg" />
</HomepageFeaturedItem>

There also could be a reusable component like YoutubeThumbnail or something similar to be explicit about intent instead of default behavior when left blank.

<HomepageFeaturedItem lesson="visual-proofs" caption="Latest video: How to Lie with Visual Proofs">
  <YoutubeThumbnail lesson="visual-proofs"/>
</HomepageFeaturedItem>