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

DOP-4436: Add explicit height/width for leafy-green icons #1042

Merged
merged 17 commits into from
Mar 21, 2024
Merged

Conversation

mayaraman19
Copy link
Collaborator

@mayaraman19 mayaraman19 commented Mar 19, 2024

Stories/Links:

DOP-4436

This PR adds explicit height/width attributes to the <img> tags nested in components/directives (namely cards and permalinks), so that we can improve our performance as gauged by https://pagespeed.web.dev/. I have included various staging links, which you can run through the aforementioned link and compare the results (under "Image elements do not have explicit width and height") to production. I've also included results for running the test for staging links and production links.

Staging Environments

docs-landing

homepage staging link (look at both homepage and Migrators, Tools, and Connectors)

production page speed results
staging page speed results

production MTC results
staging MTC results

cloud-docs landing page

staging link

production results
staging results

drivers landing page (docs-ecosystem)

idk why the c++ logo is broken but i swear it works in my local environment 😭
staging link

production results
staging results

404 page

staging link

production results
staging results

Notes:

Although the title of the ticket says "leafy-green icons," I didn't touch the actual Icon component because 1. I couldn't really find any examples of LeafyGreen Icons in a cursory search of some of the larger properties, 2. the component uses a LeafyGreen icon, not an image, and 3. I figured the impact is likely minimal. Open to any advice, though, since the ticket is slightly ambiguous.

README updates

    • This PR introduces changes that should be reflected in the README, and I have made those updates.
    • This PR does not introduce changes that should be reflected in the README

@mayaraman19 mayaraman19 changed the title Dop 4436 DOP-4436: Add explicit height/width for leafy-green icons Mar 19, 2024
src/components/Permalink.js Show resolved Hide resolved
src/templates/NotFound.js Show resolved Hide resolved
src/components/Card/index.js Show resolved Hide resolved
Comment on lines 156 to 162

const styles = ['landing', 'product-landing'].includes(template)
? { dim: dim, style: '' }
: { dim: dim, style: compactIconStyle };

const styling = [
cardBaseStyles,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This naming (styles and styling) is going to be confusing. I'd say either rename both of them to be more specific to what piece they're styles for. OR You could simply use dim as a variable on it's own within the <img> tag, and then have a one-liner for if the img needs the compactIconStyle

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, TOTAL NIT: could you rename dim to be slightly more indicative of what it is? iconDimension or imgDimension or anything to ensure when we look at this in a few months we have a good idea of what it is without searching

@mayaraman19 mayaraman19 requested a review from mmeigs March 20, 2024 20:21
@mayaraman19 mayaraman19 merged commit 9a767ef into main Mar 21, 2024
4 checks passed
@mayaraman19 mayaraman19 deleted the DOP-4436 branch March 21, 2024 17:16
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