dify/web/app/components/base/badge.tsx
zxhlyh 3c014f3ae5
Feat/plugins (#12547)
Co-authored-by: AkaraChen <akarachen@outlook.com>
Co-authored-by: Yi <yxiaoisme@gmail.com>
Co-authored-by: Joel <iamjoel007@gmail.com>
Co-authored-by: JzoNg <jzongcode@gmail.com>
Co-authored-by: twwu <twwu@dify.ai>
Co-authored-by: kurokobo <kuro664@gmail.com>
Co-authored-by: Hiroshi Fujita <fujita-h@users.noreply.github.com>
2025-01-09 18:47:41 +08:00

38 lines
950 B
TypeScript

import type { ReactNode } from 'react'
import { memo } from 'react'
import cn from '@/utils/classnames'
type BadgeProps = {
className?: string
text?: ReactNode
children?: ReactNode
uppercase?: boolean
hasRedCornerMark?: boolean
}
const Badge = ({
className,
text,
children,
uppercase = true,
hasRedCornerMark,
}: BadgeProps) => {
return (
<div
className={cn(
'relative inline-flex items-center px-[5px] h-5 rounded-[5px] border border-divider-deep leading-3 text-text-tertiary',
uppercase ? 'system-2xs-medium-uppercase' : 'system-xs-medium',
className,
)}
>
{hasRedCornerMark && (
<div className='absolute top-[-2px] right-[-2px] w-1.5 h-1.5 border border-components-badge-status-light-error-border-inner bg-components-badge-status-light-error-bg rounded-[2px] shadow-sm'>
</div>
)}
{children || text}
</div>
)
}
export default memo(Badge)