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">
|
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">
|
|
|
|
<Icon
|
|
|
|
icon={icon}
|
|
|
|
feather={featherIcon}
|
|
|
|
className="space-right feather"
|
|
|
|
/>
|
|
|
|
</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>
|
|
|
|
);
|
|
|
|
}
|