-
Notifications
You must be signed in to change notification settings - Fork 10
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 the possibility to specify css class to generated img html tag #145
Comments
Hey @alxistn You should be able to pass a class prop directly to the component, this will be merged into the tag classes
This results in this HTML: (Abbreviated the TransformationURL for clarity)
Is that what you had in mind? |
Yes exactly ! Or to be more specific, because you could still want to style the container it could be something like that:
and that will generate:
|
Hey @alxistn, the
which would resolve to -
This looks like what you are looking for - #145 (comment) Another thing to note is that if you do wrap the |
@alxistn it depends on how you use the component, for example a simple rendering as I've shown above:
Generates this (full) html - without a div
However, if you're using a placeholder an example, you are indeed getting a wrapping div, with this HTML
Note how in this case, only the top-most HTML element receives the className (So just the div, but not the img) Given this information, can you explain what exactly you'd like to achieve? |
Given this I would need this result:
|
Thanks @alxistn , now it's understood. Although this goes against the way Vue works (The top-most component always gets the class passed to the component), this does sound like something that can help make things more consistent. It looks like the best approach would be to add a new prop specifically for the |
Great ! This is what I had in mind but I'm not sure how to process given that I don't have the rights to do so |
@alxistn You should be able to fork the project (Top right in your github UI), once you've forked the repo, you can commit to your fork copy your changes, then you can open a PR from the fork to this repository. Once the PR is open we'll get a notification and we can start the review process. |
@patrick-tolosa thanks for the explanation. I was able to submit the PR 👌 (#148) |
Explain your use case
I want to be able to add a class to cld-image component that will be passed down to the generated element
Do you have a proposed solution?
Create a props to cld-image component named "imgClass" that will be concatenated to the rendered element
The text was updated successfully, but these errors were encountered: