refactor: unified cn utils (#29916)
Co-authored-by: yyh <yuanyouhuilyz@gmail.com> Co-authored-by: yyh <92089059+lyzno1@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import Tooltip from '@/app/components/base/tooltip'
|
||||
import Indicator from '@/app/components/header/indicator'
|
||||
import classNames from '@/utils/classnames'
|
||||
import { cn } from '@/utils/classnames'
|
||||
import { memo, useMemo, useRef, useState } from 'react'
|
||||
import { useAllBuiltInTools, useAllCustomTools, useAllMCPTools, useAllWorkflowTools } from '@/service/use-tools'
|
||||
import { getIconFromMarketPlace } from '@/utils/get-icon'
|
||||
@@ -60,9 +60,7 @@ export const ToolIcon = memo(({ providerName }: ToolIconProps) => {
|
||||
disabled={!notSuccess}
|
||||
>
|
||||
<div
|
||||
className={classNames(
|
||||
'relative',
|
||||
)}
|
||||
className={cn('relative')}
|
||||
ref={containerRef}
|
||||
>
|
||||
<div className="flex size-5 items-center justify-center overflow-hidden rounded-[6px] border-[0.5px] border-components-panel-border-subtle bg-background-default-dodge">
|
||||
@@ -73,19 +71,15 @@ export const ToolIcon = memo(({ providerName }: ToolIconProps) => {
|
||||
return <img
|
||||
src={icon}
|
||||
alt='tool icon'
|
||||
className={classNames(
|
||||
'size-3.5 h-full w-full object-cover',
|
||||
notSuccess && 'opacity-50',
|
||||
)}
|
||||
className={cn('size-3.5 h-full w-full object-cover',
|
||||
notSuccess && 'opacity-50')}
|
||||
onError={() => setIconFetchError(true)}
|
||||
/>
|
||||
}
|
||||
if (typeof icon === 'object') {
|
||||
return <AppIcon
|
||||
className={classNames(
|
||||
'size-3.5 h-full w-full object-cover',
|
||||
notSuccess && 'opacity-50',
|
||||
)}
|
||||
className={cn('size-3.5 h-full w-full object-cover',
|
||||
notSuccess && 'opacity-50')}
|
||||
icon={icon?.content}
|
||||
background={icon?.background}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user