import React, { ReactElement } from 'react';
import { useProviderContext } from '@agentscope-ai/chat';
import { IconButton } from '@agentscope-ai/design';
import Style from './style/footer';
export default function Footer(props: {
left?: React.ReactElement;
right?: React.ReactElement;
}) {
const { getPrefixCls } = useProviderContext();
const prefixCls = getPrefixCls('bubble-footer');
const { left, right } = props;
if ((left && !left.type) || (right && !right.type)) return null;
return <>
{props.left}
{props.right}
>;
}
interface IAction {
icon: string | ReactElement,
label?: string,
onClick: () => void
children?: React.ReactElement;
}
export function FooterActions(props: {
data: (IAction)[]
}) {
const { getPrefixCls } = useProviderContext();
const prefixCls = getPrefixCls('bubble-footer-actions');
return
{props.data.map((item, index) => {
if (item.children) {
return React.cloneElement(item.children, { key: index });
} else {
return
}
})}
;
};
export function FooterCount(props: {
data: [string | number, string | number][]
}) {
const { getPrefixCls } = useProviderContext();
const prefixCls = getPrefixCls('bubble-footer-count');
return
{props.data.map(item => {
return
{item[0]}:{item[1]}
})}
;
}
Footer.Actions = FooterActions;
Footer.Count = FooterCount;