forked from pterodactyl/panel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDialogIcon.tsx
More file actions
31 lines (25 loc) · 913 Bytes
/
DialogIcon.tsx
File metadata and controls
31 lines (25 loc) · 913 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import React, { useContext, useEffect } from 'react';
import { CheckIcon, ExclamationIcon, InformationCircleIcon, ShieldExclamationIcon } from '@heroicons/react/outline';
import classNames from 'classnames';
import { DialogContext, DialogIconProps, styles } from './';
const icons = {
danger: ShieldExclamationIcon,
warning: ExclamationIcon,
success: CheckIcon,
info: InformationCircleIcon,
};
export default ({ type, position, className }: DialogIconProps) => {
const { setIcon, setIconPosition } = useContext(DialogContext);
useEffect(() => {
const Icon = icons[type];
setIcon(
<div className={classNames(styles.dialog_icon, styles[type], className)}>
<Icon className={'w-6 h-6'} />
</div>
);
}, [type, className]);
useEffect(() => {
setIconPosition(position);
}, [position]);
return null;
};