|
1 | 1 | import * as React from "react"; |
2 | | -import {CoursePreviewView} from "../../api/"; |
| 2 | +import {CoursePreviewView} from "@/api"; |
3 | 3 | import {NavLink} from "react-router-dom"; |
4 | 4 | import MentorsList from "../Common/MentorsList"; |
5 | | -import {Box, Divider, Grid, ListItem, Typography} from "@mui/material"; |
| 5 | +import {Box, Divider, Grid, ListItem, Skeleton, Typography} from "@mui/material"; |
6 | 6 | import NameBuilder from "../Utils/NameBuilder"; |
7 | 7 |
|
8 | 8 | interface ICoursesProps { |
9 | 9 | navigate: any |
10 | | - courses: CoursePreviewView[]; |
| 10 | + courses: CoursePreviewView[] | undefined; |
11 | 11 | isExpert: boolean |
12 | 12 | } |
13 | 13 |
|
14 | 14 | export class CoursesList extends React.Component<ICoursesProps, {}> { |
15 | 15 | public render() { |
16 | 16 | const {courses, isExpert} = this.props; |
| 17 | + const ghostCoursesRand = [45, 12, 23, 3, 67, 50, 19] |
17 | 18 |
|
18 | 19 | return ( |
19 | 20 | <Box> |
20 | 21 | <Grid container direction="column"> |
21 | | - {courses.map((course, i) => ( |
| 22 | + {courses === undefined && ghostCoursesRand.map((rand, i) => { |
| 23 | + return <Grid item key={i}> |
| 24 | + <Skeleton variant="rectangular" animation="wave" width={300 + rand} height={25} |
| 25 | + style={{marginBottom: 5}}/> |
| 26 | + <Skeleton variant="rectangular" animation="wave" width={50 + rand} height={14} |
| 27 | + style={{marginBottom: 10}}/> |
| 28 | + <Skeleton variant="rectangular" animation="wave" width={150 + rand} height={20}/> |
| 29 | + {i < ghostCoursesRand.length - 1 ? |
| 30 | + <Divider style={{marginTop: 10, marginBottom: 10}}/> : null} |
| 31 | + </Grid>; |
| 32 | + })} |
| 33 | + {courses && courses.map((course, i) => ( |
22 | 34 | <Grid item key={course.id}> |
23 | 35 | <ListItem |
24 | 36 | style={{padding: 0, marginBottom: 5}} |
|
0 commit comments