import PropTypes from 'prop-types'

const FarmControlAppIcon = ({ alt = 'Farm Control Logo', style, ...props }) => {
  const useRelativePath =
    typeof window !== 'undefined' && window.location.href.includes('index.html')

  return (
    <img
      src={`${useRelativePath ? '.' : ''}/logo512.png`}
      alt={alt}
      style={style}
      {...props}
    />
  )
}

FarmControlAppIcon.propTypes = {
  alt: PropTypes.string,
  style: PropTypes.object
}

export default FarmControlAppIcon
