Skip to content

Commit

Permalink
Create timeline skeleton loader
Browse files Browse the repository at this point in the history
  • Loading branch information
campb303 committed Feb 23, 2021
1 parent d4961b5 commit 0470bbe
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/components/TimelineSkeleton/TimelineSkeleton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from "react";
import { Paper, Typography, makeStyles, useTheme } from '@material-ui/core';
import { Skeleton } from '@material-ui/lab';

export default function TimelineSkeleton(){

const theme = useTheme();
const useStyles = makeStyles({
"Paper-root": {
overflow: "hidden"
},
"padding": {
padding: theme.spacing(1)
}

});
const classes = useStyles();

return(
<Paper classes={{root: classes["Paper-root"]}}>
<div className={classes.padding}>
<Typography variant="body1">
<Skeleton />
</Typography>
</div>
<div className={classes.padding}>
{[...Array(2).keys()].map( _ => <Skeleton /> )}
</div>
</Paper>
);
}
17 changes: 17 additions & 0 deletions src/components/TimelineSkeleton/TimelineSkeleton.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Renders a skeleton UI to indicate loading of a timeline item.

```jsx
import { ThemeProvider } from "@material-ui/core/styles";
import webqueue2Theme from "../../theme";
import TimelineActionCard from "./TimelineSkeleton";

const theme = webqueue2Theme(false);

<ThemeProvider theme={theme}>
<TimelineSkeleton />
</ThemeProvider>
```

```jsx static
<TimelineSkeleton />
```
1 change: 1 addition & 0 deletions src/components/TimelineSkeleton/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from "./TimelineSkeleton";

0 comments on commit 0470bbe

Please sign in to comment.