@@ -2,19 +2,13 @@ import React, { useState } from 'react'
2
2
import { Label } from 'reactstrap'
3
3
import '../index.css'
4
4
5
- const AutoFillDropDown = ( {
6
- employerOnChange,
7
- isEmpty,
8
- label,
9
- name,
10
- arrayList
11
- } ) => {
5
+ const EmployerDropDown = ( { employerOnChange, isEmpty, arrayList } ) => {
12
6
const [ value , setValue ] = useState ( '' )
13
7
const filteredEmployers = arrayList . filter ( item => {
14
8
const searchTerm = value . toLowerCase ( )
15
9
const employer = item . name . toLowerCase ( )
16
10
const matchSearch = employer . includes ( searchTerm )
17
- return searchTerm && matchSearch
11
+ return searchTerm && matchSearch && employer !== searchTerm
18
12
} )
19
13
const employerSorter = ( a , b ) => {
20
14
const aIndex = a . name . toLowerCase ( ) . indexOf ( value . toLowerCase ( ) )
@@ -28,11 +22,11 @@ const AutoFillDropDown = ({
28
22
}
29
23
return (
30
24
< div className = "form-group" >
31
- < Label htmlFor = { name } > { label } </ Label >
25
+ < Label htmlFor = "employer" > "Who is your employer?" </ Label >
32
26
< input
33
27
className = { `form-control ${ isEmpty && 'is-empty' } ` }
34
28
type = "text"
35
- id = { name }
29
+ id = "employer"
36
30
value = { value }
37
31
onChange = { e => setValue ( e . target . value ) }
38
32
placeholder = "Type your employer name here"
@@ -57,4 +51,4 @@ const AutoFillDropDown = ({
57
51
)
58
52
}
59
53
60
- export default AutoFillDropDown
54
+ export default EmployerDropDown
0 commit comments