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

[docs] Lazy load landing page images #17827

Merged
merged 2 commits into from
Oct 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/src/modules/components/HomeSteps.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ function HomeSteps(props) {
className={classes.img}
alt="themes"
src={`/static/images/themes-${theme.palette.type}.jpg`}
loading="eager"
width={500}
Copy link
Member

Choose a reason for hiding this comment

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

I believe we override the dimension with CSS, do we need to specify something here?

Copy link
Member Author

Choose a reason for hiding this comment

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

The browser needs to to calculate a proper placeholder and avoid layout shifts.

height={307}
/>
</NoSsr>
</Link>
Expand Down
24 changes: 17 additions & 7 deletions docs/src/modules/components/HomeUsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,46 @@ import Typography from '@material-ui/core/Typography';
const users = [
{
logo: 'nasa.svg',
logoWidth: 49,
logoHeight: 40,
caption: 'NASA',
},
{
logo: 'walmart-labs.svg',
logoWidth: 253,
logoHeight: 48,
caption: 'Walmart Labs',
class: 'walmart',
},
{
logo: 'capgemini.svg',
logoWidth: 180,
logoHeight: 40,
caption: 'Capgemini',
},
{
logo: 'uniqlo.svg',
logoWidth: 40,
logoHeight: 40,
caption: 'Uniqlo',
},
{
logo: 'bethesda.svg',
logoWidth: 196,
logoHeight: 29,
caption: 'Bethesda',
class: 'noDescenders',
},
{
logo: 'jpmorgan.svg',
logoWidth: 198,
logoHeight: 40,
caption: 'J.P. Morgan',
},
{
logo: 'shutterstock.svg',
caption: 'Shutterstock',
class: 'noDescenders',
logoWidth: 205,
logoHeight: 29,
},
];

Expand All @@ -60,14 +72,9 @@ const styles = theme => ({
},
img: {
margin: theme.spacing(1.5, 3),
height: 40,
},
noDescenders: {
height: 29,
},
walmart: {
margin: theme.spacing(1.1, 3, 1.5),
height: 48,
},
});

Expand All @@ -93,6 +100,9 @@ function HomeUsers(props) {
src={`/static/images/users/${user.logo}`}
alt={user.caption}
className={clsx(classes.img, classes[user.class])}
loading="lazy"
oliviertassinari marked this conversation as resolved.
Show resolved Hide resolved
width={user.logoWidth}
height={user.logoHeight}
/>
))}
</Grid>
Expand Down
10 changes: 5 additions & 5 deletions docs/src/modules/components/backers.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ Gold Sponsors are those who have pledged $500/month and more to Material-UI.
via [Patreon](https://www.patreon.com/oliviertassinari)

<p style="display: flex; justify-content: center;">
<a data-ga-event-category="sponsors" data-ga-event-action="logo" data-ga-event-label="creative-tim" href="https://www.creative-tim.com/?partner=104080" rel="noopener nofollow" target="_blank" style="margin-right: 16px;"><img width="126" src="https://github.com/creativetimofficial.png?size=126" alt="creative-tim" title="Premium Themes"></a>
<a data-ga-event-category="sponsors" data-ga-event-action="logo" data-ga-event-label="tidelift" href="https://tidelift.com/subscription/pkg/npm-material-ui?utm_source=material_ui&utm_medium=referral&utm_campaign=homepage" rel="noopener nofollow" target="_blank" style="margin-right: 16px;"><img width="96" src="https://github.com/tidelift.png?size=96" alt="tidelift" title="Get Professionally Supported Material-UI"></a>
<a data-ga-event-category="sponsors" data-ga-event-action="logo" data-ga-event-label="bitsrc" href="https://bit.dev" rel="noopener nofollow" target="_blank" style="margin-right: 16px;"><img width="96" src="https://github.com/teambit.png?size=96" alt="bitsrc" title="The fastest way to share code"></a>
<a data-ga-event-category="sponsors" data-ga-event-action="logo" data-ga-event-label="blokt" href="https://blokt.com/" rel="noopener nofollow" target="_blank" style="margin-right: 16px;"><img width="96" src="https://material-ui.com/static/images/blokt.jpg" alt="blokt" title="Leading Cryptocurrency News"></a>
<a data-ga-event-category="sponsors" data-ga-event-action="logo" data-ga-event-label="creative-tim" href="https://www.creative-tim.com/?partner=104080" rel="noopener nofollow" target="_blank" style="margin-right: 16px;"><img width="126" src="https://github.com/creativetimofficial.png?size=126" alt="creative-tim" title="Premium Themes" loading="lazy"></a>
<a data-ga-event-category="sponsors" data-ga-event-action="logo" data-ga-event-label="tidelift" href="https://tidelift.com/subscription/pkg/npm-material-ui?utm_source=material_ui&utm_medium=referral&utm_campaign=homepage" rel="noopener nofollow" target="_blank" style="margin-right: 16px;"><img width="96" src="https://github.com/tidelift.png?size=96" alt="tidelift" title="Get Professionally Supported Material-UI" loading="lazy"></a>
<a data-ga-event-category="sponsors" data-ga-event-action="logo" data-ga-event-label="bitsrc" href="https://bit.dev" rel="noopener nofollow" target="_blank" style="margin-right: 16px;"><img width="96" src="https://github.com/teambit.png?size=96" alt="bitsrc" title="The fastest way to share code" loading="lazy"></a>
<a data-ga-event-category="sponsors" data-ga-event-action="logo" data-ga-event-label="blokt" href="https://blokt.com/" rel="noopener nofollow" target="_blank" style="margin-right: 16px;"><img width="96" src="https://material-ui.com/static/images/blokt.jpg" alt="blokt" title="Leading Cryptocurrency News" loading="lazy"></a>
</p>

via [OpenCollective](https://opencollective.com/material-ui)

<p style="display: flex; justify-content: center; flex-wrap: wrap;">
<a data-ga-event-category="sponsors" data-ga-event-action="logo" data-ga-event-label="callemall" href="https://www.call-em-all.com" rel="noopener nofollow" target="_blank" style="margin-right: 16px;">
<img src="https://images.opencollective.com/proxy/images?src=https%3A%2F%2Fopencollective-production.s3-us-west-1.amazonaws.com%2Ff4053300-e0ea-11e7-acf0-0fa7c0509f4e.png&height=100" alt="callemall" title="The easy way to message your group">
<img src="https://images.opencollective.com/proxy/images?src=https%3A%2F%2Fopencollective-production.s3-us-west-1.amazonaws.com%2Ff4053300-e0ea-11e7-acf0-0fa7c0509f4e.png&height=100" alt="callemall" title="The easy way to message your group" width=100 loading="lazy">
</a>
</p>

Expand Down