Add a thumbnail component for new hybrid learning features #8225
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
For my work on the completion modal #8109, I needed to create a new thumbnail component which also draws from recent JB's hybrid learning work. I'll soon be preparing the rest of JB's work for merge and I will need to have this component available. Because we won't be able to merge the completion modal for some time, I've extracted the thumbnail logic from the completion modal to this separate PR.
The component displays a topic or learning activity icon when a picture is not available. Regarding the thumbnail container ratio, we decided to go with 16:9 as that's the most common ratio of thumbnails. Pictures with different ratios are letterboxed. The thumbnail adjusts its width according to its container width to allow for flexible control from parent components which is important when implementing responsive behavior across hybrid learning features.
Besides that, this PR extends the utility function for getting thumbnails from the content node to account for cases when simplified data are returned from API for a content node where the thumbnail is saved directly in the
thumbnail
attribute.Thumbnail
component screenshotsReferences
As for the decisions about icons colors and thumbnail container ratio, you can see this Slack thread.
Reviewer guidance
Since this is only a prerequisite component for work that will be reviewed in the future, I think that briefly checking code and screenshots is sufficient at this point. However, if you'd like to preview it locally on the dev server, I can provide my completion modal working branch.
Testing checklist
PR process
Reviewer checklist
yarn
andpip
)