-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TimeSeries Widget: Add a skeleton for loading state (#686)
- Loading branch information
Showing
8 changed files
with
132 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from 'react'; | ||
import { SvgIcon } from '@mui/material'; | ||
|
||
export default function GraphLine(props) { | ||
return ( | ||
<SvgIcon width='720' height='124' viewBox='0 0 720 124' {...props}> | ||
<path | ||
d='M0.74707 123C11.8168 119.656 26.7934 118.37 53.4909 102.164C73.1959 90.2031 92.5604 81.3284 108.188 76.6983C122.841 72.357 136.188 74.3832 144.653 75.1549C150.496 75.6876 195.443 82.8718 207.164 83.6435C218.885 84.4152 241.676 87.502 274.234 80.5567C306.791 73.6115 305.869 75.4585 330.233 67.438C388.837 48.1456 433.461 2.6348 458.511 1.07229C495.627 -1.24279 512.557 52.7758 539.255 58.1776C565.952 63.5795 583.534 64.3512 601.766 55.0909C619.999 45.8305 625.859 40.4287 646.045 38.1136C666.231 35.7985 683.812 41.972 718.975 70.5247' | ||
stroke='currentColor' | ||
strokeWidth='2' | ||
strokeLinejoin='round' | ||
vectorEffect='non-scaling-stroke' | ||
/> | ||
</SvgIcon> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
packages/react-ui/src/widgets/TimeSeriesWidgetUI/components/TimeSeriesSkeleton.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import React from 'react'; | ||
import { Box, Grid, styled } from '@mui/material'; | ||
import { Skeleton } from '@mui/material'; | ||
import { SKELETON_HEIGHT, SkeletonBarsGrid } from '../../SkeletonWidgets'; | ||
import { BREAKPOINTS } from '../../../theme/themeConstants'; | ||
import GraphLine from '../../../assets/images/GraphLine'; | ||
|
||
const Root = styled(Grid)(({ theme }) => ({ | ||
alignItems: 'stretch', | ||
containerType: 'inline-size', | ||
|
||
[`@container (max-width: ${BREAKPOINTS.XS}px)`]: { | ||
' > div': { | ||
marginRight: 0 | ||
} | ||
} | ||
})); | ||
|
||
const Controls = styled(Grid)(({ theme }) => ({ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
justifyContent: 'space-between', | ||
marginRight: theme.spacing(4) | ||
})); | ||
|
||
const Graph = styled(Grid)(({ theme }) => ({ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
justifyContent: 'flex-end', | ||
marginBottom: theme.spacing(2) | ||
})); | ||
|
||
const SkeletonGraphLine = styled(SkeletonBarsGrid)(({ theme }) => ({ | ||
svg: { | ||
width: '100%', | ||
height: 'auto', | ||
minHeight: theme.spacing(20), | ||
paddingTop: theme.spacing(4), | ||
fontSize: 'initial', | ||
fill: 'none', | ||
|
||
path: { | ||
stroke: theme.palette.black[8] | ||
} | ||
} | ||
})); | ||
|
||
const TimeSeriesSkeleton = ({ height }) => { | ||
return ( | ||
<Root container height={height || SKELETON_HEIGHT}> | ||
<Controls item> | ||
<Grid item> | ||
<Skeleton width={48} height={8} /> | ||
</Grid> | ||
|
||
<Grid item> | ||
{[...Array(3)].map((_, i) => ( | ||
<Box key={i} mt={2}> | ||
<Skeleton width={24} height={24} /> | ||
</Box> | ||
))} | ||
</Grid> | ||
</Controls> | ||
|
||
<Graph item xs> | ||
<SkeletonGraphLine height='80%'> | ||
<GraphLine preserveAspectRatio='none' /> | ||
</SkeletonGraphLine> | ||
</Graph> | ||
</Root> | ||
); | ||
}; | ||
|
||
export default TimeSeriesSkeleton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters