app/frontend/app/components/ui/Alert.tsx
2025-11-09 13:09:22 +01:00

34 lines
No EOL
817 B
TypeScript

import React from "react"
import classNames from "classnames";
interface Props {
children: React.ReactNode;
className?: string;
type: 'error' | 'warning' | 'info' | 'success';
}
const Alert = ({ children, className, type }: Props) => {
let bgColor = 'bg-blue-200'
let fgColor = 'bg-blue-800'
if (type == 'error') {
bgColor = 'bg-red-200'
fgColor = 'bg-red-800'
} else if (type == 'warning') {
bgColor = 'bg-orange-200'
fgColor = 'bg-orange-800'
} else if (type == 'success') {
bgColor = 'border-2 border-green-500'
fgColor = 'text-green-500'
}
const styles = classNames(fgColor, bgColor, className, 'rounded')
return (
<div className={styles}>
{ children}
</div>
)
}
export default Alert