2022-08-02 12:17:22 +12:00
|
|
|
import { PropsWithChildren } from 'react';
|
2022-11-28 15:00:28 +13:00
|
|
|
import { AlertCircle } from 'lucide-react';
|
2023-02-23 01:43:33 +05:30
|
|
|
import clsx from 'clsx';
|
2021-11-30 15:31:16 +13:00
|
|
|
|
2023-01-24 12:20:55 +05:30
|
|
|
import { Icon, IconMode } from '@@/Icon';
|
2022-07-27 10:47:38 -03:00
|
|
|
|
2022-01-23 16:48:04 -03:00
|
|
|
type Color = 'orange' | 'blue';
|
|
|
|
|
|
|
|
export interface Props {
|
2023-01-24 12:20:55 +05:30
|
|
|
icon?: React.ReactNode;
|
2022-01-23 16:48:04 -03:00
|
|
|
color?: Color;
|
2023-02-23 01:43:33 +05:30
|
|
|
className?: string;
|
2022-01-23 16:48:04 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
export function TextTip({
|
|
|
|
color = 'orange',
|
2023-01-24 12:20:55 +05:30
|
|
|
icon = AlertCircle,
|
2023-02-23 01:43:33 +05:30
|
|
|
className,
|
2022-01-23 16:48:04 -03:00
|
|
|
children,
|
|
|
|
}: PropsWithChildren<Props>) {
|
2023-01-24 12:20:55 +05:30
|
|
|
return (
|
2023-05-14 09:26:11 +07:00
|
|
|
<div className={clsx('small inline-flex gap-1', className)}>
|
|
|
|
<Icon icon={icon} mode={getMode(color)} className="!mt-[2px]" />
|
|
|
|
|
2023-01-24 12:20:55 +05:30
|
|
|
<span className="text-muted">{children}</span>
|
2023-03-07 18:45:39 +02:00
|
|
|
</div>
|
2023-01-24 12:20:55 +05:30
|
|
|
);
|
|
|
|
}
|
2022-07-27 10:47:38 -03:00
|
|
|
|
2023-01-24 12:20:55 +05:30
|
|
|
function getMode(color: Color): IconMode {
|
2022-07-27 10:47:38 -03:00
|
|
|
switch (color) {
|
|
|
|
case 'blue':
|
2023-01-24 12:20:55 +05:30
|
|
|
return 'primary';
|
2022-07-27 10:47:38 -03:00
|
|
|
case 'orange':
|
|
|
|
default:
|
2023-01-24 12:20:55 +05:30
|
|
|
return 'warning';
|
2022-07-27 10:47:38 -03:00
|
|
|
}
|
2021-11-30 15:31:16 +13:00
|
|
|
}
|