/
TimurIsm
/
OpenEyes
Обзор
Документация
Войти
/
TimurIsm
/
OpenEyes
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
front/src/components/AlertMessage.jsx
21 строка
1 KB
IsmTimur
Initial commit: added backend (Express) and frontend (React Vite)
19 июн 2025, 18:32
19 июн 2025, 18:32
6cf6155
Код
Авторство
О чём код?
import React from 'react'; const AlertMessage = ({ type, message }) => { const isSuccess = type === 'success'; const bgColor = isSuccess ? 'bg-green-50' : 'bg-red-50'; const textColor = isSuccess ? 'text-green-800' : 'text-red-800'; const iconPath = isSuccess ? 'M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z' : 'M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z'; return ( <div className={`flex items-center p-4 mb-4 text-sm rounded-lg ${bgColor} ${textColor}`} role="alert"> <svg className="shrink-0 inline w-4 h-4 me-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20"> <path d={iconPath} /> </svg> <span className="font-medium">{message}</span> </div> ); }; export default AlertMessage;