Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pterodactyl
GitHub Repository: pterodactyl/panel
Path: blob/1.0-develop/resources/scripts/components/elements/alert/Alert.tsx
10293 views
1
import { ExclamationIcon, ShieldExclamationIcon } from '@heroicons/react/outline';
2
import React from 'react';
3
import classNames from 'classnames';
4
5
interface AlertProps {
6
type: 'warning' | 'danger';
7
className?: string;
8
children: React.ReactNode;
9
}
10
11
export default ({ type, className, children }: AlertProps) => {
12
return (
13
<div
14
className={classNames(
15
'flex items-center border-l-8 text-gray-50 rounded-md shadow px-4 py-3',
16
{
17
['border-red-500 bg-red-500/25']: type === 'danger',
18
['border-yellow-500 bg-yellow-500/25']: type === 'warning',
19
},
20
className
21
)}
22
>
23
{type === 'danger' ? (
24
<ShieldExclamationIcon className={'w-6 h-6 text-red-400 mr-2'} />
25
) : (
26
<ExclamationIcon className={'w-6 h-6 text-yellow-500 mr-2'} />
27
)}
28
{children}
29
</div>
30
);
31
};
32
33