-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into TSJR-275
- Loading branch information
Showing
25 changed files
with
605 additions
and
337 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,24 @@ | ||
import _ from 'lodash'; | ||
import { createActions } from 'redux-actions'; | ||
import { getService } from '../services/dashboard'; | ||
|
||
const service = getService(); | ||
|
||
function fetchChallenges(query) { | ||
return service.getChallenges(query); | ||
function fetchChallengesInit(title) { | ||
return title; | ||
} | ||
|
||
async function fetchChallenges(title, query) { | ||
const challenges = await service.getChallenges(query); | ||
|
||
return { | ||
challenges, | ||
title, | ||
}; | ||
} | ||
|
||
export default createActions({ | ||
DASHBOARD: { | ||
FETCH_CHALLENGES_INIT: _.noop, | ||
FETCH_CHALLENGES_INIT: fetchChallengesInit, | ||
FETCH_CHALLENGES_DONE: fetchChallenges, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
134 changes: 134 additions & 0 deletions
134
src/shared/components/GUIKit/DropdownSingleSkills/index.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
/* eslint-disable jsx-a11y/label-has-for */ | ||
/** | ||
* Dropdown terms component. | ||
*/ | ||
import React, { | ||
useRef, | ||
useEffect, | ||
} from 'react'; | ||
import PT from 'prop-types'; | ||
import { AsyncCreatable } from 'react-select'; | ||
import './style.scss'; | ||
|
||
function DropdownSingleSkills({ | ||
terms, | ||
placeholder, | ||
label, | ||
required, | ||
onChange, | ||
errorMsg, | ||
cacheOptions, | ||
loadOptions, | ||
createText, | ||
}) { | ||
const containerRef = useRef(null); | ||
useEffect(() => { | ||
const selectInput = containerRef.current.getElementsByClassName('Select-input'); | ||
if (selectInput && selectInput.length) { | ||
const inputField = selectInput[0].getElementsByTagName('input'); | ||
inputField[0].style.border = 'none'; | ||
inputField[0].style.boxShadow = 'none'; | ||
selectInput[0].style.borderTop = 'none'; | ||
} | ||
}, [terms]); | ||
|
||
const CustomReactSelectRow = React.forwardRef(({ | ||
className, | ||
option, | ||
children, | ||
onSelect, | ||
}, ref) => (children ? ( | ||
<a | ||
ref={ref} | ||
role="button" | ||
className={className} | ||
onMouseDown={(event) => { | ||
event.preventDefault(); | ||
event.stopPropagation(); | ||
onSelect(option, event); | ||
}} | ||
title={option.title} | ||
tabIndex={-1} | ||
> | ||
{children} | ||
</a> | ||
) : null)); | ||
|
||
CustomReactSelectRow.defaultProps = { | ||
children: null, | ||
className: '', | ||
onSelect: () => {}, | ||
}; | ||
|
||
CustomReactSelectRow.propTypes = { | ||
children: PT.node, | ||
className: PT.string, | ||
onSelect: PT.func, | ||
option: PT.object.isRequired, | ||
}; | ||
|
||
return ( | ||
<div | ||
ref={containerRef} | ||
className="dropdownContainer" | ||
styleName={`container ${ | ||
terms ? 'haveValue' : '' | ||
} ${errorMsg ? 'haveError' : ''}`} | ||
> | ||
<div styleName="relative"> | ||
<AsyncCreatable | ||
autosize={false} | ||
optionComponent={CustomReactSelectRow} | ||
value={terms ? { | ||
value: terms, | ||
label: terms, | ||
} : null} | ||
onChange={(value) => { | ||
onChange(value ? (value.value || '') : ''); | ||
}} | ||
defaultValue={terms ? { | ||
value: terms, | ||
label: terms, | ||
} : null} | ||
promptTextCreator={value => `${createText} "${value}"`} | ||
placeholder={`${placeholder}${placeholder && required ? ' *' : ''}`} | ||
cacheOptions={cacheOptions} | ||
loadOptions={loadOptions} | ||
/> | ||
</div> | ||
{label ? ( | ||
<span styleName="label"> | ||
{label} | ||
{required ? <span> *</span> : null} | ||
</span> | ||
) : null} | ||
{errorMsg ? <span styleName="errorMessage">{errorMsg}</span> : null} | ||
</div> | ||
); | ||
} | ||
|
||
DropdownSingleSkills.defaultProps = { | ||
terms: '', | ||
placeholder: '', | ||
label: '', | ||
required: false, | ||
cacheOptions: false, | ||
onChange: () => {}, | ||
errorMsg: '', | ||
createText: 'Select', | ||
loadOptions: undefined, | ||
}; | ||
|
||
DropdownSingleSkills.propTypes = { | ||
terms: PT.string, | ||
placeholder: PT.string, | ||
label: PT.string, | ||
required: PT.bool, | ||
cacheOptions: PT.bool, | ||
onChange: PT.func, | ||
errorMsg: PT.string, | ||
createText: PT.string, | ||
loadOptions: PT.func, | ||
}; | ||
|
||
export default DropdownSingleSkills; |
71 changes: 71 additions & 0 deletions
71
src/shared/components/GUIKit/DropdownSingleSkills/style.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
@import '../Dropdown/style.scss'; | ||
|
||
.label { | ||
z-index: 6; | ||
} | ||
|
||
.relative { | ||
position: relative; | ||
} | ||
|
||
.errorMessage, | ||
.haveValue, | ||
.haveError { | ||
font-family: Roboto, sans-serif; | ||
} | ||
|
||
.container { | ||
font-family: Roboto, sans-serif; | ||
|
||
:global { | ||
.Select-control { | ||
min-height: 52px; | ||
height: auto; | ||
display: flex !important; | ||
overflow: visible !important; | ||
} | ||
|
||
.Select-clear-zone, | ||
.Select-clear { | ||
font-size: 21px; | ||
line-height: 40px; | ||
|
||
&:hover { | ||
color: $dashboard-teal; | ||
} | ||
} | ||
|
||
.Select-value { | ||
font-size: 14px !important; | ||
padding-right: 42px !important; | ||
overflow: hidden; | ||
|
||
.Select-value-label { | ||
font-size: 14px; | ||
max-width: 100%; | ||
text-overflow: ellipsis; | ||
overflow: hidden; | ||
} | ||
} | ||
|
||
.Select-input { | ||
input { | ||
font-size: 14px; | ||
|
||
&::-webkit-input-placeholder { | ||
/* Edge */ | ||
color: $gui-kit-gray-30; | ||
} | ||
|
||
&:-ms-input-placeholder { | ||
/* Internet Explorer 10-11 */ | ||
color: $gui-kit-gray-30; | ||
} | ||
|
||
&::placeholder { | ||
color: $gui-kit-gray-30; | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.