summaryrefslogtreecommitdiff
path: root/client/src/components/Gender/Gender.jsx
blob: 0079fc3a1da60b1d0930f57746f51111373a1661 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import React from 'react'
import { useTranslation } from 'react-i18next'
import EditButton from '../../components/EditButton/EditButton'
import LabelCard from '../LabelCard/LabelCard'
import styles from './Gender.module.css'

const Gender = ({ formData, setFormData }) => {
  const { t } = useTranslation()
  const [editable, setEditable] = React.useState(true)

  const handleEdit = () => {
    setEditable(!editable)
  }
  return (
    <div className={styles.formone__gender}>
      <LabelCard
        id="male"
        name="gender"
        title={t('MALE')}
        value={formData?.gender}
        readOnly={editable}
        onChange={() => {
          setFormData({
            ...formData,
            gender: 'Male'
          })
        }}
        image={`${process.env.PUBLIC_URL}/assets/images/male.svg`}
      />
      <LabelCard
        id="female"
        name="gender"
        value={formData?.gender}
        title={t('FEMALE')}
        readOnly={editable}
        onChange={() => {
          setFormData({
            ...formData,
            gender: 'Female'
          })
        }}
        image={`${process.env.PUBLIC_URL}/assets/images/female.svg`}
      />
      <LabelCard
        id="trans"
        name="gender"
        value={formData?.gender}
        title={t('OTHER')}
        readOnly={editable}
        onChange={() => {
          setFormData({
            ...formData,
            gender: 'Other'
          })
        }}
        image={`${process.env.PUBLIC_URL}/assets/images/trans.svg`}
      />
      <EditButton onClick={handleEdit} enabled={!editable ? '1' : '0'} />
    </div>
  )
}

export default Gender