Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a way to supply a fallback image to the Image component #163

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

fabiankaegy
Copy link
Member

Description of the Change

This is an exploration of how we could potentially handle adding a fallback image option to the image component.

Closes #161

How to test the Change

Changelog Entry

Added - Ability to provide a fallback image for the Image component

Credits

Props @ncoetzer @sudar @ajmaurya99

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@fabiankaegy fabiankaegy self-assigned this Oct 25, 2022
Comment on lines +20 to 26
"image": {
"type": "object",
"default": {
"id": null,
"fallback": null
}
},
Copy link
Contributor

@ncoetzer ncoetzer Oct 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fabiankaegy Essentially, I think we could have gone two ways about this:

  1. The way you approached it here by using a single prop structured as an object with two values, i.e., id & fallback, respectively. However, I'm just wondering about any possible confusion about what type of data needs to be provided for these two values, i.e., number vs. string.
  2. OR perhaps it would be more clear (and less complex) to define the fallback image URL as a separate prop (optional), e.g.,
"imageId": {
    "type": "number",
    "default": null
},
"fallbackImageUrl": {
    "type": "string",
    "default": ""
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add the ability to provide a fallback image to the Image component that gets used in the block example
2 participants