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;
|
2022-06-23 06:32:18 +00:00
|
|
|
featherIcon?: boolean;
|
2021-11-16 14:51:49 +00:00
|
|
|
className?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function WidgetTitle({
|
|
|
|
title,
|
|
|
|
icon,
|
|
|
|
className,
|
|
|
|
children,
|
2022-06-23 06:32:18 +00:00
|
|
|
featherIcon,
|
2021-11-16 14:51:49 +00:00
|
|
|
}: PropsWithChildren<Props>) {
|
|
|
|
useWidgetContext();
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="widget-header">
|
|
|
|
<div className="row">
|
|
|
|
<span className={clsx('pull-left', className)}>
|
2022-06-23 06:32:18 +00:00
|
|
|
<Icon icon={icon} feather={featherIcon} className="space-right" />
|
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>
|
|
|
|
);
|
|
|
|
}
|