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

fix: add classes for picture tag in media component #11605

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Tajmirul
Copy link
Contributor

Sometimes I need to add some classes to the picture tag of Media component. in this case I need to do this:

<Media
    resource={content.image}
    className="w-full h-full [&>picture]:w-full"  // <<< follow this
    imgClassName="w-full h-full object-cover"
/>

So I added an additional props pictureClassName for the picture tag. Now I can do this:

<Media
    resource={content.image}
    className="w-full h-full"
    pictureClassName="w-full h-full" // <<< follow this
    imgClassName="w-full h-full object-cover"
/>

NOTE: I've encountered situations where I needed to add classes to the picture tag, not just for w-full h-full. To handle this, I had to update the Media component. I believe this would be a valuable improvement to the Media component.

@Tajmirul Tajmirul marked this pull request as draft March 12, 2025 11:16
@Tajmirul Tajmirul marked this pull request as ready for review March 12, 2025 11:17
@GermanJablo GermanJablo enabled auto-merge (squash) March 12, 2025 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants