dify/web/app/components/plugins/card/card-more-info.tsx

37 lines
1.0 KiB
TypeScript
Raw Normal View History

2024-10-10 17:47:04 +08:00
import DownloadCount from './base/download-count'
2024-10-09 18:36:15 +08:00
2024-10-10 17:47:04 +08:00
type Props = {
downloadCount?: number
2024-10-10 17:47:04 +08:00
tags: string[]
2024-10-09 18:36:15 +08:00
}
2024-10-10 17:47:04 +08:00
const CardMoreInfo = ({
downloadCount,
tags,
}: Props) => {
return (
<div className="flex items-center h-5">
{downloadCount !== undefined && <DownloadCount downloadCount={downloadCount} />}
{downloadCount !== undefined && tags && tags.length > 0 && <div className="mx-2 text-text-quaternary system-xs-regular">·</div>}
2024-10-10 17:47:04 +08:00
{tags && tags.length > 0 && (
<>
2024-10-16 16:39:47 +08:00
<div className="flex flex-wrap space-x-2 h-4 overflow-hidden">
2024-10-10 17:47:04 +08:00
{tags.map(tag => (
2024-10-16 16:39:47 +08:00
<div
key={tag}
className="flex space-x-1 system-xs-regular max-w-[120px] overflow-hidden"
title={`# ${tag}`}
>
2024-10-10 17:47:04 +08:00
<span className="text-text-quaternary">#</span>
2024-10-16 16:39:47 +08:00
<span className="truncate text-text-tertiary">{tag}</span>
2024-10-10 17:47:04 +08:00
</div>
))}
</div>
</>
)}
</div>
)
}
export default CardMoreInfo