Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | 1x 1x 1x 1x 1x 4x 8x 8x | import { Card, CircularProgress, Typography } from "@mui/material"; import { CSSProperties } from "@mui/styles"; import Alert from "components/Alert"; import TextBody from "components/TextBody"; import React from "react"; import makeStyles from "utils/makeStyles"; const useStyles = makeStyles((theme) => ({ circularProgress: { display: "block", margin: `0 auto ${theme.spacing(1)}`, }, container: { margin: theme.spacing(2), "& > *": { marginBottom: theme.spacing(2), }, }, errorAlert: { borderRadius: 0, }, header: { fontWeight: theme.typography.fontWeightBold, marginBottom: theme.spacing(2), marginLeft: theme.spacing(1), } as CSSProperties, noFriendItemText: { marginLeft: theme.spacing(1), }, })); interface FriendTileProps { children: React.ReactNode; errorMessage: string | null; hasData: boolean; isLoading: boolean; noDataMessage: string; title: string; } function FriendTile({ children, errorMessage, hasData, isLoading, noDataMessage, title, }: FriendTileProps) { const classes = useStyles(); return ( <Card> <div className={classes.container}> <Typography className={classes.header} variant="h2"> {title} </Typography> {errorMessage ? ( <Alert className={classes.errorAlert} severity="error"> {errorMessage} </Alert> ) : null} {isLoading ? ( <CircularProgress className={classes.circularProgress} /> ) : hasData ? ( children ) : ( <TextBody className={classes.noFriendItemText}> {noDataMessage} </TextBody> )} </div> </Card> ); } export default FriendTile; |