-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
118 lines (112 loc) · 2.61 KB
/
index.js
File metadata and controls
118 lines (112 loc) · 2.61 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
import { Field } from 'formik'
import { array, func } from 'prop-types'
import Select from 'react-select'
const selectStyles = {
container: (styles) => ({
...styles,
width: '33vw',
'@media only screen and (max-width: 1023px)': {
...styles['@media only screen and (max-width: 1023px)'],
display: 'inline-block',
width: '100%',
},
}),
control: (styles) => ({
...styles,
background: 'rgba(236, 236, 236, 0.2)',
width: '100%',
border: '0',
padding: '1.2rem 2rem',
borderRadius: '24px',
marginBottom: '2rem',
fontFamily: 'lato',
fontWeight: '500',
fontSize: '14px',
textAlign: 'left',
}),
placeholder: (styles) => ({
...styles,
fontFamily: 'lato',
fontWeight: '400',
fontSize: '18px',
lineHeight: '140%',
}),
menu: (styles) => ({
...styles,
backgroundColor: 'rgba(32,28,68, 0.8)',
}),
valueContainer: (styles) => ({
...styles,
lineHeight: '36px',
overflow: 'inherit',
padding: '0 0 0 0',
'@media only screen and (max-width: 1023px)': {
...styles['@media only screen and (max-width: 1023px)'],
},
}),
multiValue: (styles) => ({
...styles,
color: '#fff',
backgroundColor: 'transparent',
}),
multiValueLabel: (styles) => ({
...styles,
color: '#fff',
fontFamily: 'lato',
fontWeight: '400',
fontSize: '16px',
padding: '0 0 0 0',
}),
multiValueRemove: (styles) => ({
...styles,
':hover': {
color: '#aaa',
backgroundColor: 'transparent',
},
}),
option: (styles, { isFocused, isSelected }) => {
const optionsStyles = {
...styles,
':active': {
...styles,
backgroundColor: '#452643',
},
}
if (isFocused) {
optionsStyles.backgroundColor = '#0a0b24'
} else if (isSelected) {
optionsStyles.color = '#fff'
optionsStyles.backgroundColor = 'transparent'
}
return optionsStyles
},
}
const MultiSelect = ({ options, ...props }) => {
const handleChange = (value) => {
props.onChange('resources', value)
}
const handleBlur = () => {
props.onBlur('resources', true)
}
return (
<Field
{...props}
as={Select}
isMulti
placeholder="What Commit resources have you seen prior to applying?"
closeMenuOnSelect={false}
blurInputOnSelect={false}
isSearchable={false}
styles={selectStyles}
options={options}
onChange={handleChange}
onBlur={handleBlur}
/>
)
}
MultiSelect.propTypes = {
options: array.isRequired,
onChange: func.isRequired,
onBlur: func.isRequired,
}
export default MultiSelect