|
|
|
@@ -1,4 +1,5 @@ |
|
|
|
import { IconMap } from '@/constants/setting'; |
|
|
|
import { cn } from '@/lib/utils'; |
|
|
|
import Icon, { UserOutlined } from '@ant-design/icons'; |
|
|
|
import { IconComponentProps } from '@ant-design/icons/lib/components/Icon'; |
|
|
|
import { Avatar } from 'antd'; |
|
|
|
@@ -25,14 +26,21 @@ interface IProps extends IconComponentProps { |
|
|
|
name: string; |
|
|
|
width: string | number; |
|
|
|
height?: string | number; |
|
|
|
imgClass?: string; |
|
|
|
} |
|
|
|
|
|
|
|
const SvgIcon = ({ name, width, height, ...restProps }: IProps) => { |
|
|
|
const SvgIcon = ({ name, width, height, imgClass, ...restProps }: IProps) => { |
|
|
|
const ListItem = routeList.find((item) => item.name === name); |
|
|
|
return ( |
|
|
|
<Icon |
|
|
|
component={() => ( |
|
|
|
<img src={ListItem?.value} alt="" width={width} height={height} /> |
|
|
|
<img |
|
|
|
src={ListItem?.value} |
|
|
|
alt="" |
|
|
|
width={width} |
|
|
|
height={height} |
|
|
|
className={cn(imgClass, 'max-w-full')} |
|
|
|
/> |
|
|
|
)} |
|
|
|
{...(restProps as any)} |
|
|
|
/> |
|
|
|
@@ -44,16 +52,23 @@ export const LlmIcon = ({ |
|
|
|
height = 48, |
|
|
|
width = 48, |
|
|
|
size = 'large', |
|
|
|
imgClass, |
|
|
|
}: { |
|
|
|
name: string; |
|
|
|
height?: number; |
|
|
|
width?: number; |
|
|
|
size?: AvatarSize; |
|
|
|
imgClass?: string; |
|
|
|
}) => { |
|
|
|
const icon = IconMap[name as keyof typeof IconMap]; |
|
|
|
|
|
|
|
return icon ? ( |
|
|
|
<SvgIcon name={`llm/${icon}`} width={width} height={height}></SvgIcon> |
|
|
|
<SvgIcon |
|
|
|
name={`llm/${icon}`} |
|
|
|
width={width} |
|
|
|
height={height} |
|
|
|
imgClass={imgClass} |
|
|
|
></SvgIcon> |
|
|
|
) : ( |
|
|
|
<Avatar shape="square" size={size} icon={<UserOutlined />} /> |
|
|
|
); |