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

Support voor calculated values #1434

Open
stijns96 opened this issue Aug 22, 2024 · 3 comments
Open

Support voor calculated values #1434

stijns96 opened this issue Aug 22, 2024 · 3 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@stijns96
Copy link

I want to be able to pass calcs to the sizes attribute.

Example
sizes="100vw md:calc(100vw - 40px) 2xl:636px"

Looks like this is not possible at the moment, while this is possible on the native img element.

@Baroshem
Copy link
Collaborator

Hey there,

Would you be able to contribute with that change? 🙏

@Baroshem Baroshem added the good first issue Good for newcomers label Dec 13, 2024
@stijns96
Copy link
Author

Hi @Baroshem,

https://github.com/stijns96/image/tree/feat/sizes-calc-support

Currently trying to fix it.

@stijns96
Copy link
Author

stijns96 commented Dec 26, 2024

Hi @Baroshem,

I think I mentioned this already somewhere, but all screens are set to their absolute values and transformed to a max-width.

Example
100vw md:50vw -> (max-width: 768px) 100vw, 50vw

md: in tailwind is transformed to (min-width: 768px). That means that exactly 1px is overlapping. Nuxt IMG should be transform to 768 - 1 so the max width is 767.

Is there a reason why it is like this? I'm also not really sure why we don't just use (min-width). Images are a pain in the ass, but using max-width makes it even harder.

Let me know! I think it would be much beter to maybe even do a bigger refactor where a couple of issues are fixed al together. Because to be honest, even after adding this fix, I would still not use Nuxt Image because of these behaviours.

Related
#1413
#1433

100vw md:50vw should be (min-width: 768px) 50vw, 100vw. To me this would work so much better and is also more inline with mobile first design and development

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants