2021-11-16 14:51:49 +00:00
|
|
|
import clsx from 'clsx';
|
|
|
|
import { PropsWithChildren, ReactNode } from 'react';
|
|
|
|
|
2022-06-23 06:32:18 +00:00
|
|
|
import { Icon } from '@/react/components/Icon';
|
|
|
|
|
2021-11-16 14:51:49 +00:00
|
|
|
import { useWidgetContext } from './Widget';
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
title: ReactNode;
|
|
|
|
icon: ReactNode;
|
|
|
|
className?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function WidgetTitle({
|
|
|
|
title,
|
|
|
|
icon,
|
|
|
|
className,
|
|
|
|
children,
|
|
|
|
}: PropsWithChildren<Props>) {
|
|
|
|
useWidgetContext();
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="widget-header">
|
|
|
|
<div className="row">
|
2022-09-02 15:30:34 +00:00
|
|
|
<span className={clsx('pull-left vertical-center', className)}>
|
2022-08-10 04:12:20 +00:00
|
|
|
<div className="widget-icon">
|
2022-11-28 02:00:28 +00:00
|
|
|
<Icon icon={icon} className="space-right" />
|
2022-08-10 04:12:20 +00:00
|
|
|
</div>
|
2022-03-16 06:35:32 +00:00
|
|
|
<span>{title}</span>
|
2021-11-16 14:51:49 +00:00
|
|
|
</span>
|
|
|
|
<span className={clsx('pull-right', className)}>{children}</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|