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] Prevent layout jumps from img loading in system demo #23504

Merged
merged 3 commits into from
Nov 14, 2020
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
23 changes: 14 additions & 9 deletions docs/src/pages/system/basics/Demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ import Box from '@material-ui/core/Box';
import { alpha } from '@material-ui/core/styles';
import ErrorOutlineIcon from '@material-ui/icons/ErrorOutline';

function Img(props) {
return <Box component="img" {...props} />;
}

export default function Demo() {
return (
<Box
Expand All @@ -21,11 +17,20 @@ export default function Demo() {
fontWeight: 'fontWeightBold',
}}
>
<Img
sx={{ width: '100%', maxWidth: { xs: 350, md: 250 } }}
alt="The house from the offer."
src="https://images.unsplash.com/photo-1512917774080-9991f1c4c750?auto=format&w=400&dpr=2"
/>
<Box
sx={{
maxHeight: { xs: 233, md: 167 },
maxWidth: { xs: 350, md: 250 },
}}
clone
eps1lon marked this conversation as resolved.
Show resolved Hide resolved
>
<img
alt="The house from the offer."
height="233"
width="350"
eps1lon marked this conversation as resolved.
Show resolved Hide resolved
src="https://images.unsplash.com/photo-1512917774080-9991f1c4c750?auto=format&w=350&dpr=2"
/>
</Box>
<Box
sx={{
display: 'flex',
Expand Down
30 changes: 15 additions & 15 deletions docs/src/pages/system/basics/Demo.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
import * as React from 'react';
import Box, { BoxProps } from '@material-ui/core/Box';
import Box from '@material-ui/core/Box';
import { alpha } from '@material-ui/core/styles';
import ErrorOutlineIcon from '@material-ui/icons/ErrorOutline';

interface ImgProps extends BoxProps {
src?: string;
alt?: string;
}

function Img(props: ImgProps) {
return <Box component="img" {...props} />;
}

export default function Demo() {
return (
<Box
Expand All @@ -26,11 +17,20 @@ export default function Demo() {
fontWeight: 'fontWeightBold',
}}
>
<Img
sx={{ width: '100%', maxWidth: { xs: 350, md: 250 } }}
alt="The house from the offer."
src="https://images.unsplash.com/photo-1512917774080-9991f1c4c750?auto=format&w=400&dpr=2"
/>
<Box
sx={{
maxHeight: { xs: 233, md: 167 },
maxWidth: { xs: 350, md: 250 },
}}
clone
>
<img
alt="The house from the offer."
height="233"
width="350"
src="https://images.unsplash.com/photo-1512917774080-9991f1c4c750?auto=format&w=350&dpr=2"
/>
</Box>
<Box
sx={{
display: 'flex',
Expand Down