Created
February 2, 2022 20:32
-
-
Save gndx/89582bf88d4ea223bffe3784037a3e7c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { XCircleIcon } from '@heroicons/react/solid'; | |
const Alert = ({ alert, handleClose }) => { | |
if (alert && alert?.autoClose) { | |
setTimeout(() => { | |
handleClose(); | |
}, 9000); | |
} | |
return ( | |
<> | |
{alert?.active && ( | |
<div x-data className="bg-indigo-100 p-5 w-full rounded mb-8"> | |
<div className="flex space-x-3"> | |
<div className="flex-1 leading-tight text-sm text-black font-medium">{alert.message}</div> | |
<button type="button"> | |
<XCircleIcon className="w-6 h-6 text-gray-600" onClick={handleClose} /> | |
</button> | |
</div> | |
</div> | |
)} | |
</> | |
); | |
}; | |
export default Alert; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment