|
1 | 1 | // MessagePopup.js
|
2 | 2 | import React from 'react';
|
3 |
| -import { FaShare } from 'react-icons/fa'; |
| 3 | +import { FaCheckCircle, FaExclamationCircle } from 'react-icons/fa'; |
4 | 4 |
|
5 | 5 | const MessagePopup = ({ type, message, onClose }) => {
|
6 |
| - const { title, description } = message || {}; |
| 6 | + const { title, description } = message || {}; |
7 | 7 |
|
8 |
| - const titleColor = type === 'error' ? 'text-red-500' : 'text-custom-blue'; |
9 |
| - const descriptionColor = type === 'error' ? 'text-red-500' : ''; |
| 8 | + const IconComponent = type === 'error' ? FaExclamationCircle : FaCheckCircle; |
10 | 9 |
|
11 |
| - return ( |
12 |
| - <div className="fixed inset-0 flex items-center justify-center z-50"> |
13 |
| - <div className="absolute inset-0 bg-black opacity-50" onClick={() => onClose()}></div> |
| 10 | + const titleColor = type === 'error' ? 'text-red-500' : 'text-green-600'; |
14 | 11 |
|
15 |
| - <div className="bg-white p-4 rounded-lg shadow-lg w-full lg:w-[33.33%] sm:w-[66.67%] z-10 relative m-4"> |
16 |
| - <div class="flex items-start justify-between border-b rounded-t dark:border-gray-600"> |
| 12 | + return ( |
| 13 | + <div className="fixed inset-0 flex items-center justify-center z-50"> |
| 14 | + <div className="absolute inset-0 bg-black opacity-50" onClick={() => onClose()}></div> |
17 | 15 |
|
18 |
| - <h2 className={`text-lg font-bold mb-2 flex items-center ${titleColor}`}> |
19 |
| - <FaShare size={20} className="inline mr-1 mb-1" /> |
20 |
| - {title} |
21 |
| - </h2> |
22 |
| - <button type="button" class="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 ml-auto inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white" onClick={() => onClose()}> |
23 |
| - <svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14"> |
24 |
| - <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6" /> |
25 |
| - </svg> |
26 |
| - </button> |
27 |
| - </div> |
28 |
| - <hr className="mb-2 border-t border-custom-blue/80" /> |
29 |
| - <p className={`mb-2 mt-4 ${descriptionColor}`}> |
30 |
| - {description} |
31 |
| - </p> |
32 |
| - <div className="flex justify-end space-x-2 pt-4"> |
33 |
| - <button |
34 |
| - type="button" |
35 |
| - className="rounded-md text-sm border border-transparent shadow-sm px-4 py-2 bg-gray-500 text-white hover:bg-gray-600" |
36 |
| - onClick={onClose} |
37 |
| - > |
38 |
| - Close |
39 |
| - </button> |
40 |
| - </div> |
41 |
| - </div> |
42 |
| - </div> |
43 |
| - ); |
| 16 | + <div className="bg-white p-4 rounded-lg shadow-lg w-full lg:w-[33.33%] sm:w-[66.67%] z-10 relative m-4"> |
| 17 | + <div className="flex items-start justify-between border-b rounded-t dark:border-gray-600"> |
| 18 | + |
| 19 | + <h2 className={`text-lg font-bold mb-2 flex items-center ${titleColor}`}> |
| 20 | + <IconComponent size={20} className="inline mr-1" /> |
| 21 | + {title} |
| 22 | + </h2> |
| 23 | + <button type="button" className="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 ml-auto inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white" onClick={() => onClose()}> |
| 24 | + <svg className="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14"> |
| 25 | + <path stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6" /> |
| 26 | + </svg> |
| 27 | + </button> |
| 28 | + </div> |
| 29 | + <hr className="mb-2 border-t border-custom-blue/80" /> |
| 30 | + <p className="mb-2 mt-4"> |
| 31 | + {description} |
| 32 | + </p> |
| 33 | + <div className="flex justify-end space-x-2 pt-4"> |
| 34 | + <button |
| 35 | + type="button" |
| 36 | + className="px-4 py-2 text-white bg-gray-500 hover:bg-gray-600 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-gray-300 dark:hover:bg-gray-400" |
| 37 | + onClick={onClose} |
| 38 | + > |
| 39 | + Close |
| 40 | + </button> |
| 41 | + </div> |
| 42 | + </div> |
| 43 | + </div> |
| 44 | + ); |
44 | 45 | };
|
45 | 46 |
|
46 | 47 | export default MessagePopup;
|
0 commit comments