import { alpha, styled, Typography, TypographyProps } from '@mui/material'

export default function FormLabel({ label, required, name }) {
  if (typeof label !== 'string') return label

  return (
    <Typography
      htmlFor={name}
      component="label"
      sx={{
        color: alpha('#121212', 0.5),
        lineHeight: 2,
        '& span': {
          color: (theme) => theme.palette.error.main,
        },
      }}
    >
      {label} {required && <span>{' *'}</span>}
    </Typography>
  )
}
