You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

plugins-selected.tsx 900B

1234567891011121314151617181920212223242526272829
  1. 'use client'
  2. import type { FC } from 'react'
  3. import React from 'react'
  4. import cn from '@/utils/classnames'
  5. import { MARKETPLACE_API_PREFIX } from '@/config'
  6. import Icon from '@/app/components/plugins/card/base/card-icon'
  7. const MAX_DISPLAY_COUNT = 14
  8. type Props = {
  9. className?: string
  10. plugins: string[]
  11. }
  12. const PluginsSelected: FC<Props> = ({
  13. className,
  14. plugins,
  15. }) => {
  16. const isShowAll = plugins.length < MAX_DISPLAY_COUNT
  17. const displayPlugins = plugins.slice(0, MAX_DISPLAY_COUNT)
  18. return (
  19. <div className={cn('flex items-center space-x-1', className)}>
  20. {displayPlugins.map(plugin => (
  21. <Icon key={plugin} size='tiny' src={`${MARKETPLACE_API_PREFIX}/plugins/${plugin}/icon`} />
  22. ))}
  23. {!isShowAll && <div className='system-xs-medium text-text-tertiary'>+{plugins.length - MAX_DISPLAY_COUNT}</div>}
  24. </div>
  25. )
  26. }
  27. export default React.memo(PluginsSelected)