Skip to content
Snippets Groups Projects
StepIdentityAndPdl.tsx 2.03 KiB
Newer Older
  • Learn to ignore specific revisions
  • import { Button, TextField } from '@material-ui/core'
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    import SgeModalHint from 'components/Connection/SGEConnect/SgeModalHint'
    
    import { useI18n } from 'cozy-ui/transpiled/react/I18n'
    
    import { SgeStore } from 'models'
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    import React, { useState } from 'react'
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    import { SGEKeysForm } from './SgeConnectView'
    
    
    interface StepIdentityAndPdlProps {
      sgeState: SgeStore
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
      onChange: (
        key: SGEKeysForm,
        value: string | number,
        maxLength?: number
      ) => void
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    const StepIdentityAndPdl = ({
    
      sgeState,
      onChange,
    }: StepIdentityAndPdlProps) => {
      const { t } = useI18n()
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
      const [openHintModal, setOpenHintModal] = useState<boolean>(false)
    
        <div className="stepDetails stepIdentity">
          <h2 className="text-22-bold">
    
            {t('auth.enedissgegrandlyon.identityTitle')}
    
          <TextField
            label={t('auth.enedissgegrandlyon.firstName')}
            variant="outlined"
            type="text"
            id="firstName"
            value={sgeState.firstName}
            onChange={e => onChange('firstName', e.target.value)}
            required
    
            autoComplete="given-name"
    
          />
          <TextField
            label={t('auth.enedissgegrandlyon.lastName')}
            variant="outlined"
            type="text"
            id="lastName"
            value={sgeState.lastName}
            onChange={e => onChange('lastName', e.target.value)}
            required
    
            autoComplete="family-name"
    
          <h2 className="text-22-bold">{t('auth.enedissgegrandlyon.pdlTitle')}</h2>
    
          <TextField
            label={t('auth.enedissgegrandlyon.pdlLabel')}
            variant="outlined"
            id="pdl"
            type="number"
    
            onChange={e => onChange('pdl', e.target.value, 14)}
            inputMode="numeric"
            required
          />
    
          <Button className="btnText" onClick={() => setOpenHintModal(true)}>
    
            {t('auth.enedissgegrandlyon.pdlModal.title')}
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
          </Button>
    
          <SgeModalHint
            open={openHintModal}
            handleCloseClick={() => setOpenHintModal(false)}
          />
    
        </div>
      )
    }
    
    export default StepIdentityAndPdl