misc_pterodactyl-panel/resources/scripts/components/elements/alert/Alert.tsx

32 lines
1,000 B
TypeScript
Raw Normal View History

2022-07-02 22:53:03 +00:00
import { ExclamationIcon, ShieldExclamationIcon } from '@heroicons/react/outline';
2022-11-25 20:25:03 +00:00
import * as React from 'react';
import classNames from 'classnames';
interface AlertProps {
2022-07-02 22:53:03 +00:00
type: 'warning' | 'danger';
className?: string;
children: React.ReactNode;
}
2022-07-02 22:53:03 +00:00
export default ({ type, className, children }: AlertProps) => {
return (
<div
className={classNames(
2023-01-12 19:31:47 +00:00
'flex items-center rounded-md border-l-8 px-4 py-3 text-slate-50 shadow',
2022-07-02 22:53:03 +00:00
{
['border-red-500 bg-red-500/25']: type === 'danger',
['border-yellow-500 bg-yellow-500/25']: type === 'warning',
},
2022-11-25 20:25:03 +00:00
className,
)}
>
2022-07-02 22:53:03 +00:00
{type === 'danger' ? (
2023-01-12 19:31:47 +00:00
<ShieldExclamationIcon className={'mr-2 h-6 w-6 text-red-400'} />
2022-07-02 22:53:03 +00:00
) : (
2023-01-12 19:31:47 +00:00
<ExclamationIcon className={'mr-2 h-6 w-6 text-yellow-500'} />
2022-07-02 22:53:03 +00:00
)}
{children}
</div>
);
};