import type { FC } from 'react'

type Props = { id?:        string
	       messages?:  string[] }


export const FieldWarning: FC<Props> = ({ id, messages }: Props) => {
  if (messages == null || messages.length === 0)
    return null

  return (
      <ul id={id} className="mt-1 space-y-1 text-amber-700 dark:text-amber-200">
	{messages.map ((message, i) => <li key={i}>{message}</li>)}
      </ul>)
}


export default FieldWarning
