hugo-PaperMod icon indicating copy to clipboard operation
hugo-PaperMod copied to clipboard

feat(layouts): add iconWidth support for icon

Open airscripts opened this issue 3 years ago • 3 comments
trafficstars

What does this PR change? What problem does it solve?

Adds support for a new field in config's params called iconWidth.
With iconWidth set, Lighthouse will not complain about Cumulative Shift Layouts.
More on topic here.

Was the change discussed in an issue or in the Discussions before? No, it wasn't treated about icons specifically.

PR Checklist

  • [ ] This change adds/updates translations and I have used the template present here.
  • [ ] I have enabled maintainer edits for this PR.
  • [x] I have verified that the code works as described/as intended.
  • [ ] This change adds a Social Icon which has a permissive license to use it.
  • [x] This change does not include any CDN resources/links.
  • [x] This change does not include any unrelated scripts such as bash and python scripts.
  • [ ] This change updates the overridden internal templates from HUGO's repository.

airscripts avatar Aug 21 '22 14:08 airscripts

@Airscripts Height is enough for resizing the icon keeping the aspect ratio intact. What we can do for cls thing here is print the width of image, which is already available in hugo context. We can add the param for images where the width isn't calculable.

@Airscripts on a side note, if u can, please take a look at #962 for fixing cls as well

adityatelange avatar Aug 21 '22 14:08 adityatelange

@adityatelange I've removed the resize on width and tested it up.
In the meantime I've even cleaned up the code a little bit, just to make it more readable and maintainable.

About the #962 I can look at it for sure.
I'll let you know what it needs to be done in order to work properly and eventually I'll open a dedicated PR.

Thanks!

airscripts avatar Aug 21 '22 16:08 airscripts

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

sonarqubecloud[bot] avatar Aug 21 '22 16:08 sonarqubecloud[bot]