Use Image from @plone/volto/components/theme/Image/Image instead of semantic-ui-react #6754
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.
This is part of #3592, to address #4290.
That PR is to make Volto run on a subpath. For example:
http://mydomain.com/site
The idea is to use
react-router
's basename property to prefix routes. However, it doesn't add a prefix to the src of the img tag. So, to solve this, the idea is to insert the prefix in theImage
component of@plone/volto/components/theme/Image/Image
. Then all Volto images would be rendered with the Volto component.The Image component of semantic-ui-react generates an img tag. That's why we want to stop using it.
Some points of this PR:
The only thing that the
size
property of theImage
of semantic-ui-react does is add a class to the img tag. So we use theclassName
property of Volto'sImage
to simulate this behavior.The semantic-ui-react
Image
adds the "ui" and "image" classes. So we use theclassName
property of the Volto Image for this.If you agree, we can use an eslint check to prevent the semantic-ui-react component from being used in the future.