NewAppCard.tsx 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. 'use client'
  2. import { forwardRef, useState } from 'react'
  3. import classNames from 'classnames'
  4. import { useTranslation } from 'react-i18next'
  5. import style from '../list.module.css'
  6. import NewAppDialog from './NewAppDialog'
  7. export type CreateAppCardProps = {
  8. onSuccess?: () => void
  9. }
  10. const CreateAppCard = forwardRef<HTMLAnchorElement, CreateAppCardProps>(({ onSuccess }, ref) => {
  11. const { t } = useTranslation()
  12. const [showNewAppDialog, setShowNewAppDialog] = useState(false)
  13. return (
  14. <a ref={ref} className={classNames(style.listItem, style.newItemCard)} onClick={() => setShowNewAppDialog(true)}>
  15. <div className={style.listItemTitle}>
  16. <span className={style.newItemIcon}>
  17. <span className={classNames(style.newItemIconImage, style.newItemIconAdd)} />
  18. </span>
  19. <div className={classNames(style.listItemHeading, style.newItemCardHeading)}>
  20. {t('app.createApp')}
  21. </div>
  22. </div>
  23. {/* <div className='text-xs text-gray-500'>{t('app.createFromConfigFile')}</div> */}
  24. <NewAppDialog show={showNewAppDialog} onSuccess={onSuccess} onClose={() => setShowNewAppDialog(false)} />
  25. </a>
  26. )
  27. })
  28. export default CreateAppCard