Files
FastGPT/packages/web/components/common/Icon/button.tsx
Archer 4e83840c14 perf: tool call check (#4818)
* i18n

* tool call

* fix: mcp create permission;Plugin unauth tip

* fix: mcp create permission;Plugin unauth tip

* fix: Cite modal permission

* remove invalide cite

* perf: prompt

* filter fulltext search

* fix: ts

* fix: ts

* fix: ts
2025-05-15 15:51:34 +08:00

57 lines
1.2 KiB
TypeScript

import React from 'react';
import { Flex, type FlexProps } from '@chakra-ui/react';
import MyIcon from './index';
import MyTooltip from '../MyTooltip';
type Props = FlexProps & {
icon: string;
size?: string;
hoverColor?: string;
hoverBg?: string;
hoverBorderColor?: string;
tip?: string;
isLoading?: boolean;
};
const MyIconButton = ({
icon,
onClick,
hoverColor = 'primary.600',
hoverBg = 'myGray.05',
hoverBorderColor = '',
size = '1rem',
tip,
isLoading = false,
...props
}: Props) => {
return (
<MyTooltip label={tip}>
<Flex
position={'relative'}
p={1}
color={'myGray.500'}
rounded={'sm'}
alignItems={'center'}
bg={'transparent'}
transition={'background 0.1s'}
cursor={'pointer'}
_hover={{
bg: hoverBg,
color: hoverColor,
borderColor: hoverBorderColor
}}
onClick={(e) => {
if (isLoading) return;
onClick?.(e);
}}
sx={{ userSelect: 'none' }}
{...props}
>
<MyIcon name={isLoading ? 'common/loading' : (icon as any)} w={size} />
</Flex>
</MyTooltip>
);
};
export default MyIconButton;