setURL.tsx 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. 'use client'
  2. import React from 'react'
  3. import Button from '@/app/components/base/button'
  4. import { useTranslation } from 'react-i18next'
  5. type SetURLProps = {
  6. repoUrl: string
  7. onChange: (value: string) => void
  8. onNext: () => void
  9. onCancel: () => void
  10. }
  11. const SetURL: React.FC<SetURLProps> = ({ repoUrl, onChange, onNext, onCancel }) => {
  12. const { t } = useTranslation()
  13. return (
  14. <>
  15. <label
  16. htmlFor='repoUrl'
  17. className='flex flex-col items-start justify-center self-stretch text-text-secondary'
  18. >
  19. <span className='system-sm-semibold'>{t('plugin.installFromGitHub.gitHubRepo')}</span>
  20. </label>
  21. <input
  22. type='url'
  23. id='repoUrl'
  24. name='repoUrl'
  25. value={repoUrl}
  26. onChange={e => onChange(e.target.value)}
  27. className='shadows-shadow-xs system-sm-regular flex grow items-center gap-[2px]
  28. self-stretch overflow-hidden text-ellipsis rounded-lg border border-components-input-border-active
  29. bg-components-input-bg-active p-2 text-components-input-text-filled'
  30. placeholder='Please enter GitHub repo URL'
  31. />
  32. <div className='mt-4 flex items-center justify-end gap-2 self-stretch'>
  33. <Button
  34. variant='secondary'
  35. className='min-w-[72px]'
  36. onClick={onCancel}
  37. >
  38. {t('plugin.installModal.cancel')}
  39. </Button>
  40. <Button
  41. variant='primary'
  42. className='min-w-[72px]'
  43. onClick={onNext}
  44. disabled={!repoUrl.trim()}
  45. >
  46. {t('plugin.installModal.next')}
  47. </Button>
  48. </div>
  49. </>
  50. )
  51. }
  52. export default SetURL