Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

892 B
Raw Blame
import type { FC } from 'react'
import { cn } from '@langgenius/dify-ui/cn'
import { memo } from 'react'

type DatasourceIconProps = {
  size?: string
  className?: string
  iconUrl?: string
}

const ICON_CONTAINER_CLASSNAME_SIZE_MAP: Record<string, string> = {
  xs: 'w-4 h-4 rounded-[5px] shadow-xs',
  sm: 'w-5 h-5 rounded-md shadow-xs',
  md: 'w-6 h-6 rounded-lg shadow-md',
}

const DatasourceIcon: FC<DatasourceIconProps> = ({ size = 'sm', className, iconUrl }) => {
  return (
    <div
      className={cn(
        'flex items-center justify-center shadow-none',
        ICON_CONTAINER_CLASSNAME_SIZE_MAP[size],
        className,
      )}
    >
      <div
        className="size-full shrink-0 rounded-md bg-cover bg-center"
        style={{
          backgroundImage: iconUrl ? `url(${iconUrl})` : undefined,
        }}
      />
    </div>
  )
}

export default memo(DatasourceIcon)