All files / app/features/profile ProfileMarkdownInput.tsx

100% Statements 5/5
66.66% Branches 2/3
100% Functions 1/1
100% Lines 5/5

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 452x 2x 2x 2x                             529x                                                    
import { Typography } from "@mui/material";
import Alert from "components/Alert";
import MarkdownInput from "components/MarkdownInput";
import React from "react";
import { Control } from "react-hook-form";
 
interface ProfileMarkdownInputProps {
  className?: string;
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  control: Control<any>;
  defaultValue?: string;
  id: string;
  label: string;
  name: string;
  warning?: boolean;
  helperText?: string;
}
 
export default function ProfileMarkdownInput({
  className,
  control,
  defaultValue = "",
  id,
  label,
  name,
  warning,
  helperText,
}: ProfileMarkdownInputProps) {
  return (
    <div className={className}>
      <Typography variant="h2" id={`${id}-label`}>
        {label}
      </Typography>
      {warning && helperText && <Alert severity="warning">{helperText}</Alert>}
      <MarkdownInput
        control={control}
        defaultValue={defaultValue}
        id={id}
        labelId={`${id}-label`}
        name={name}
      />
    </div>
  );
}