All files / app/components IconText.tsx

100% Statements 9/9
50% Branches 1/2
100% Functions 2/2
100% Lines 8/8

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 384x     4x 4x   10x                                 4x 32x 32x 32x                      
import { Typography } from "@material-ui/core";
import { OverridableComponent } from "@material-ui/core/OverridableComponent";
import { SvgIconTypeMap } from "@material-ui/core/SvgIcon";
import React, { ReactNode } from "react";
import makeStyles from "utils/makeStyles";
 
const useStyles = makeStyles((theme) => ({
  label: {
    marginInlineStart: theme.spacing(1),
  },
  root: {
    alignItems: "center",
    display: "flex",
    marginBottom: theme.spacing(1),
    marginTop: theme.spacing(1),
  },
}));
 
interface IconTextProps {
  icon: OverridableComponent<SvgIconTypeMap<unknown, "svg">>;
  text: ReactNode;
}
 
export default function IconText({ icon, text }: IconTextProps) {
  const classes = useStyles();
  const Icon = icon;
  return (
    <div className={classes.root}>
      <Icon />
      {typeof text === "string" ? (
        <Typography className={classes.label}>{text}</Typography>
      ) : (
        <div className={classes.label}>{text}</div>
      )}
    </div>
  );
}