1- /* eslint-disable react/prop-types */
2- /* eslint-disable react/destructuring-assignment */
3- /* eslint-disable @typescript-eslint/no-unused-vars */
4- /* eslint-disable arrow-body-style */
5- /* eslint-disable @typescript-eslint/typedef */
6- /* eslint-disable indent */
7- /* eslint-disable sort-keys */
8- /* eslint-disable ordered-imports/ordered-imports */
91/* eslint-disable react/jsx-no-bind */
102import {
3+ CSSProperties ,
114 FC ,
125 useState ,
13- CSSProperties ,
146} from 'react'
15-
16- import { components , ControlProps , Options ,
17- GroupBase , MultiValue , SingleValue , StylesConfig , ActionMeta } from 'react-select'
7+ import { components , ControlProps , GroupBase ,
8+ MultiValue , Options , SingleValue , StylesConfig } from 'react-select'
189import AsyncSelect from 'react-select/async'
10+ import PropTypes from 'prop-types'
1911
12+ import { SearchIcon } from '@heroicons/react/outline'
2013import { ContentLayout } from '~/libs/ui'
2114import { Skill } from '@talentSearch/lib/models/'
2215import MatcherService from '@talentSearch/lib/services/MatcherService'
23- import { SearchIcon } from '@heroicons/react/outline'
16+
2417import SkillPill from './components/SkillPill'
2518import styles from './TalentSearch.module.scss'
2619
2720function search ( skills :Options < Skill > ) : void {
2821 alert ( JSON . stringify ( skills ) )
2922}
3023
24+ // eslint-disable-next-line react/destructuring-assignment, @typescript-eslint/typedef
3125const Control : React . FC < ControlProps < Skill , boolean , GroupBase < Skill > > > = ( { children, ...props } ) => (
3226 < components . Control { ...props } >
3327 { children }
@@ -40,6 +34,11 @@ const Control: React.FC<ControlProps<Skill, boolean, GroupBase<Skill>>> = ({ chi
4034 </ components . Control >
4135)
4236
37+ Control . propTypes = {
38+ children : PropTypes . node . isRequired ,
39+ getValue : PropTypes . func . isRequired ,
40+ }
41+
4342export const TalentSearch : FC = ( ) => {
4443 const [ skillsFilter , setSkillsFilter ] = useState < Array < Skill > > ( [ ] )
4544
@@ -49,7 +48,7 @@ export const TalentSearch: FC = () => {
4948 if ( skillsFilter ) {
5049 // Either delete the value from the list, if we're toggling one that's already in the list
5150 // Or add the new item to the list
52- skillsFilter . forEach ( ( filterSkill , index ) => {
51+ skillsFilter . forEach ( filterSkill => {
5352 if ( filterSkill . emsiId === skill . emsiId ) {
5453 deleted = true
5554 } else {
@@ -64,7 +63,7 @@ export const TalentSearch: FC = () => {
6463 }
6564 }
6665
67- function onChange ( options :MultiValue < Skill > | SingleValue < Skill > , meta : ActionMeta < Skill > ) : void {
66+ function onChange ( options :MultiValue < Skill > | SingleValue < Skill > ) : void {
6867 if ( Array . isArray ( options ) ) {
6968 setSkillsFilter ( options )
7069 } else {
@@ -74,7 +73,7 @@ export const TalentSearch: FC = () => {
7473
7574 function filteringSkill ( skill :Skill ) : boolean {
7675 let result : boolean = false
77- skillsFilter . forEach ( ( filterSkill , index ) => {
76+ skillsFilter . forEach ( filterSkill => {
7877 if ( filterSkill . emsiId === skill . emsiId ) {
7978 result = true
8079 }
@@ -84,116 +83,102 @@ export const TalentSearch: FC = () => {
8483 }
8584
8685 const popularSkills :Skill [ ] [ ] = [
87- [ { name : 'Typescript ' , emsiId : 'KS441LF7187KS0CV4B6Y ' } ,
88- { name : 'Front-End Engineering ' , emsiId : 'KS1244K6176NLVWV02B6 ' } ,
89- { name : 'Bootstrap (Front-End Framework)' , emsiId : 'KS1214R5XG4X4PY7LGY6 ' } ] ,
90- [ { name : 'Cascading Style Sheets (CSS)' , emsiId : 'KS121F45VPV8C9W3QFYH ' } ,
91- { name : 'JavaScript (Programming Language)' , emsiId : 'KS1200771D9CR9LB4MWW ' } ] ,
92- [ { name : 'HyperText Markup Language (HTML)' , emsiId : 'KS1200578T5QCYT0Z98G ' } ,
93- { name : 'IOS Development ' , emsiId : 'ES86A20379CD2AD061F3 ' } ,
94- { name : 'Node.js ' , emsiId : 'KS127296VDYS7ZFWVC46 ' } ] ,
95- [ { name : '.NET Development ' , emsiId : 'ES50D03AC9CFC1A0BC93 ' } ,
96- { name : 'C++ (Programming Language)' , emsiId : 'KS1219W70LY1GXZDSKW5 ' } ,
97- { name : 'PHP Development ' , emsiId : 'KS127SZ60YZR8B5CQKV1 ' } ] ,
98- [ { name : 'Adobe Illustrator ' , emsiId : 'KS1206V6K46N1SDVJGBD ' } ,
99- { name : 'Ruby (Programming Language)' , emsiId : 'ESD07FEE22E7EC094EB8 ' } ,
100- { name : 'Java (Programming Language)' , emsiId : 'KS120076FGP5WGWYMP0F ' } ] ,
101- [ { name : 'React Native ' , emsiId : 'KSPSGF5MXB6568UIQ4BK ' } ,
102- { name : 'User Experience (UX)' , emsiId : 'KS441PL6JPXW200W0GRQ ' } ] ,
86+ [ { emsiId : 'KS441LF7187KS0CV4B6Y ' , name : 'Typescript ' } ,
87+ { emsiId : 'KS1244K6176NLVWV02B6 ' , name : 'Front-End Engineering ' } ,
88+ { emsiId : 'KS1214R5XG4X4PY7LGY6' , name : 'Bootstrap (Front-End Framework)' } ] ,
89+ [ { emsiId : 'KS121F45VPV8C9W3QFYH' , name : 'Cascading Style Sheets (CSS)' } ,
90+ { emsiId : 'KS1200771D9CR9LB4MWW' , name : 'JavaScript (Programming Language)' } ] ,
91+ [ { emsiId : 'KS1200578T5QCYT0Z98G' , name : 'HyperText Markup Language (HTML)' } ,
92+ { emsiId : 'ES86A20379CD2AD061F3 ' , name : 'IOS Development ' } ,
93+ { emsiId : 'KS127296VDYS7ZFWVC46 ' , name : 'Node.js ' } ] ,
94+ [ { emsiId : 'ES50D03AC9CFC1A0BC93 ' , name : '.NET Development ' } ,
95+ { emsiId : 'KS1219W70LY1GXZDSKW5' , name : 'C++ (Programming Language)' } ,
96+ { emsiId : 'KS127SZ60YZR8B5CQKV1 ' , name : 'PHP Development ' } ] ,
97+ [ { emsiId : 'KS1206V6K46N1SDVJGBD ' , name : 'Adobe Illustrator ' } ,
98+ { emsiId : 'ESD07FEE22E7EC094EB8' , name : 'Ruby (Programming Language)' } ,
99+ { emsiId : 'KS120076FGP5WGWYMP0F' , name : 'Java (Programming Language)' } ] ,
100+ [ { emsiId : 'KSPSGF5MXB6568UIQ4BK ' , name : 'React Native ' } ,
101+ { emsiId : 'KS441PL6JPXW200W0GRQ' , name : 'User Experience (UX)' } ] ,
103102 ]
104103
105104 const controlStyle : CSSProperties = {
106105 borderColor : 'black' ,
107- paddingTop : '10px' ,
108106 paddingBottom : '10px' ,
107+ paddingTop : '10px' ,
109108 }
110109
111110 const placeholderStyle : CSSProperties = {
112- height : '36px' ,
113- paddingTop : '4px' ,
114111 color : '#2A2A2A' ,
115- fontSize : '16' ,
116112 fontFamily : 'Roboto' ,
113+ fontSize : '16' ,
117114 fontWeight : 400 ,
115+ height : '36px' ,
116+ paddingTop : '4px' ,
118117 }
119118
120119 const multiValueStyle : CSSProperties = {
121120 backgroundColor : 'white' ,
122121 border : '1px solid #d4d4d4' ,
123- color : '#333' ,
124122 borderRadius : '24px' ,
125- height : '32px ' ,
123+ color : '#333 ' ,
126124 fontFamily : 'Roboto' ,
127- fontWeight : '400' ,
128125 fontSize : '14' ,
129- paddingRight : '8px ' ,
130- paddingLeft : '8px ' ,
126+ fontWeight : '400 ' ,
127+ height : '32px ' ,
131128 marginRight : '10px' ,
129+ paddingLeft : '8px' ,
130+ paddingRight : '8px' ,
132131 }
133132
134133 const multiValueRemoveStyle : CSSProperties = {
135- width : '12px' ,
136- height : '12px' ,
137134 backgroundColor : '#d9d9d9' ,
135+ border : '1px solid #d4d4d4' ,
136+ borderRadius : '11px' ,
138137 color : '#333' ,
139- marginTop : 'auto' ,
138+ fontSize : '12' ,
139+ height : '12px' ,
140140 marginBottom : 'auto' ,
141- marginRight : '5px' ,
142141 marginLeft : '5px' ,
143- borderRadius : '11px' ,
144- border : '1px solid #d4d4d4' ,
145- fontSize : '12' ,
142+ marginRight : '5px' ,
143+ marginTop : 'auto' ,
146144 padding : '0px' ,
145+ width : '12px' ,
147146 }
148147
149148 const hiddenStyle : CSSProperties = {
150149 display : 'none' ,
151150 }
152151
153152 const selectStyle : StylesConfig < Skill > = {
154- control : ( provided , state ) => {
155- return {
153+ clearIndicator : provided => ( {
154+ ...provided ,
155+ ...hiddenStyle ,
156+ } ) ,
157+ control : provided => ( {
156158 ...provided ,
157159 ...controlStyle ,
158- }
159- } ,
160- multiValue : ( provided , state ) => {
161- return {
162- ...provided ,
163- ...multiValueStyle ,
164- }
165- } ,
166- multiValueRemove : ( provided , state ) => {
167- return {
160+ } ) ,
161+ dropdownIndicator : provided => ( {
162+ ...provided ,
163+ ...hiddenStyle ,
164+ } ) ,
165+ indicatorSeparator : provided => ( {
166+ ...provided ,
167+ ...hiddenStyle ,
168+ } ) ,
169+ multiValue : provided => ( {
170+ ...provided ,
171+ ...multiValueStyle ,
172+ } ) ,
173+ multiValueRemove : provided => ( {
168174 ...provided ,
169175 ...multiValueRemoveStyle ,
170- }
171- } ,
172- clearIndicator : ( provided , state ) => {
173- return {
174- ...provided ,
175- ...hiddenStyle ,
176- }
177- } ,
178- dropdownIndicator : ( provided , state ) => {
179- return {
180- ...provided ,
181- ...hiddenStyle ,
182- }
183- } ,
184- indicatorSeparator : ( provided , state ) => {
185- return {
186- ...provided ,
187- ...hiddenStyle ,
188- }
189- } ,
190- placeholder : ( provided , state ) => {
191- return {
192- ...provided ,
193- ...placeholderStyle ,
194- }
195- } ,
196- }
176+ } ) ,
177+ placeholder : provided => ( {
178+ ...provided ,
179+ ...placeholderStyle ,
180+ } ) ,
181+ }
197182 return (
198183 < ContentLayout
199184 contentClass = { styles . contentLayout }
@@ -226,9 +211,8 @@ export const TalentSearch: FC = () => {
226211 openMenuOnClick = { false }
227212 value = { skillsFilter }
228213 onChange = { (
229- newValue : MultiValue < Skill > | SingleValue < Skill > ,
230- actionMeta : ActionMeta < Skill > ,
231- ) => onChange ( newValue , actionMeta ) }
214+ newValue : MultiValue < Skill > | SingleValue < Skill > ,
215+ ) => onChange ( newValue ) }
232216 />
233217 </ div >
234218 < div className = { styles . popularSkillsContainer } >
@@ -243,9 +227,9 @@ export const TalentSearch: FC = () => {
243227 selected = { filteringSkill ( skill ) }
244228 onClick = { toggleSkill }
245229 />
246- ) ) }
230+ ) ) }
247231 </ div >
248- ) ,
232+ ) ,
249233 ) }
250234 </ div >
251235 </ ContentLayout >
0 commit comments