-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[Skeleton] Make the demos feel more realistic #38212
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import * as React from 'react'; | ||
import AspectRatio from '@mui/joy/AspectRatio'; | ||
import Box from '@mui/joy/Box'; | ||
import Stack from '@mui/joy/Stack'; | ||
import Button from '@mui/joy/Button'; | ||
import Card from '@mui/joy/Card'; | ||
import CardContent from '@mui/joy/CardContent'; | ||
|
@@ -9,7 +9,7 @@ import Typography from '@mui/joy/Typography'; | |
|
||
export default function AnimationSkeleton() { | ||
return ( | ||
<Box sx={{ display: 'flex', gap: 2 }}> | ||
<Stack spacing={2} useFlexGap> | ||
<Card variant="outlined" sx={{ width: 343 }}> | ||
<CardContent orientation="horizontal"> | ||
<Skeleton animation="wave" variant="circular" width={48} height={48} /> | ||
|
@@ -27,7 +27,7 @@ export default function AnimationSkeleton() { | |
<Skeleton animation="wave" variant="overlay"> | ||
<img | ||
alt="" | ||
src="https://images.unsplash.com/photo-1686548812883-9d3777f4c137?h=400&fit=crop&auto=format&dpr=2" | ||
src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are not supposed to have the real data at this point in time. |
||
/> | ||
</Skeleton> | ||
</AspectRatio> | ||
|
@@ -42,6 +42,6 @@ export default function AnimationSkeleton() { | |
<Skeleton animation="wave" /> | ||
</Button> | ||
</Card> | ||
</Box> | ||
</Stack> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,7 @@ | ||
<Box sx={{ m: 'auto' }}> | ||
<Avatar src={loading ? '' : '/static/images/avatar/1.jpg'}> | ||
<Skeleton loading={loading} /> | ||
</Avatar> | ||
</Box> | ||
<FormControl | ||
orientation="horizontal" | ||
sx={{ gap: 1, justifyContent: 'center' }} | ||
> | ||
<Avatar src={loading ? '' : '/static/images/avatar/1.jpg'}> | ||
<Skeleton loading={loading} /> | ||
</Avatar> | ||
<FormControl orientation="horizontal" sx={{ gap: 1 }}> | ||
<Switch | ||
size="sm" | ||
checked={loading} | ||
Comment on lines
-1
to
7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Simpler preview |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,17 @@ | ||
import * as React from 'react'; | ||
import Box from '@mui/joy/Box'; | ||
import FormControl from '@mui/joy/FormControl'; | ||
import FormLabel from '@mui/joy/FormLabel'; | ||
import Skeleton from '@mui/joy/Skeleton'; | ||
import Stack from '@mui/joy/Stack'; | ||
import Switch from '@mui/joy/Switch'; | ||
|
||
export default function GeometrySkeleton() { | ||
const [loading, setLoading] = React.useState(true); | ||
return ( | ||
<Stack spacing={2} useFlexGap> | ||
<div> | ||
<Box sx={{ m: 'auto', display: 'flex', alignItems: 'center', gap: 2 }}> | ||
<Skeleton loading={loading} variant="circular" width={48} height={48} /> | ||
<Box> | ||
<Skeleton | ||
loading={loading} | ||
variant="rectangular" | ||
width={200} | ||
height="1em" | ||
sx={{ mb: 1 }} | ||
/> | ||
<Skeleton | ||
loading={loading} | ||
variant="rectangular" | ||
width={140} | ||
height="1em" | ||
/> | ||
</Box> | ||
<Skeleton variant="circular" width={48} height={48} /> | ||
<div> | ||
<Skeleton variant="rectangular" width={200} height="1em" sx={{ mb: 1 }} /> | ||
<Skeleton variant="rectangular" width={140} height="1em" /> | ||
</div> | ||
</Box> | ||
<FormControl | ||
orientation="horizontal" | ||
sx={{ gap: 1, justifyContent: 'center' }} | ||
> | ||
<Switch | ||
size="sm" | ||
checked={loading} | ||
onChange={(event) => setLoading(event.target.checked)} | ||
/> | ||
<FormLabel>Loading</FormLabel> | ||
</FormControl> | ||
</Stack> | ||
</div> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,17 @@ | ||
import * as React from 'react'; | ||
import Box from '@mui/joy/Box'; | ||
import FormControl from '@mui/joy/FormControl'; | ||
import FormLabel from '@mui/joy/FormLabel'; | ||
import Skeleton from '@mui/joy/Skeleton'; | ||
import Stack from '@mui/joy/Stack'; | ||
import Switch from '@mui/joy/Switch'; | ||
|
||
export default function GeometrySkeleton() { | ||
const [loading, setLoading] = React.useState(true); | ||
return ( | ||
<Stack spacing={2} useFlexGap> | ||
<div> | ||
<Box sx={{ m: 'auto', display: 'flex', alignItems: 'center', gap: 2 }}> | ||
<Skeleton loading={loading} variant="circular" width={48} height={48} /> | ||
<Box> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Empty boxes like this one looks wrong, I'm expanding the thought on this in mui/mui-x#9831. |
||
<Skeleton | ||
loading={loading} | ||
variant="rectangular" | ||
width={200} | ||
height="1em" | ||
sx={{ mb: 1 }} | ||
/> | ||
<Skeleton | ||
loading={loading} | ||
variant="rectangular" | ||
width={140} | ||
height="1em" | ||
/> | ||
</Box> | ||
<Skeleton variant="circular" width={48} height={48} /> | ||
<div> | ||
<Skeleton variant="rectangular" width={200} height="1em" sx={{ mb: 1 }} /> | ||
<Skeleton variant="rectangular" width={140} height="1em" /> | ||
</div> | ||
</Box> | ||
<FormControl | ||
orientation="horizontal" | ||
sx={{ gap: 1, justifyContent: 'center' }} | ||
> | ||
<Switch | ||
size="sm" | ||
checked={loading} | ||
onChange={(event) => setLoading(event.target.checked)} | ||
/> | ||
<FormLabel>Loading</FormLabel> | ||
</FormControl> | ||
</Stack> | ||
</div> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<Box sx={{ m: 'auto', display: 'flex', alignItems: 'center', gap: 2 }}> | ||
<Skeleton variant="circular" width={48} height={48} /> | ||
<div> | ||
<Skeleton variant="rectangular" width={200} height="1em" sx={{ mb: 1 }} /> | ||
<Skeleton variant="rectangular" width={140} height="1em" /> | ||
</div> | ||
</Box> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More idomatic?