Skip to content

Commit 47b652f

Browse files
committed
GUIKit prod fixes and implement of #4890
1 parent cc714c8 commit 47b652f

File tree

8 files changed

+81
-20
lines changed

8 files changed

+81
-20
lines changed

__tests__/shared/components/GUIKit/Dropdown/__snapshots__/index.jsx.snap

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,12 @@ exports[`Default render 1`] = `
6565
valueComponent={[Function]}
6666
valueKey="value"
6767
/>
68-
<IconDown
68+
<img
69+
alt="dropdown-arraow-icon"
6970
className="src-shared-components-GUIKit-Dropdown-___style__iconDropdown___2bPox"
7071
height="9"
71-
viewBox="0 0 22 13"
72+
src="/community-app-assets/images/e740c51bb099110dff2900fa4fc94d72.png"
7273
width="15"
73-
xmlns="http://www.w3.org/2000/svg"
74-
xmlnsXlink="http://www.w3.org/1999/xlink"
7574
/>
7675
</div>
7776
</div>

__tests__/shared/components/GUIKit/DropdownTerms/__snapshots__/index.jsx.snap

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,12 @@ exports[`Default render 1`] = `
5959
]
6060
}
6161
/>
62-
<IconDown
62+
<img
63+
alt="dropdown-arrow-icon"
6364
className="src-shared-components-GUIKit-DropdownTerms-___style__iconDropdown___25Wtg"
6465
height="9"
65-
viewBox="0 0 22 13"
66+
src="/community-app-assets/images/e740c51bb099110dff2900fa4fc94d72.png"
6667
width="15"
67-
xmlns="http://www.w3.org/2000/svg"
68-
xmlnsXlink="http://www.w3.org/1999/xlink"
6968
/>
7069
</div>
7170
</div>

src/assets/images/dropdown-arrow.png

295 Bytes
Loading

src/shared/components/GUIKit/Dropdown/index.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import PT from 'prop-types';
77
import _ from 'lodash';
88
import ReactSelect from 'react-select';
99
import './style.scss';
10-
import IconDown from 'assets/images/minimal-down.svg';
10+
import iconDown from 'assets/images/dropdown-arrow.png';
1111
import { config } from 'topcoder-react-utils';
1212

1313

@@ -59,7 +59,7 @@ function Dropdown({
5959
placeholder={`${placeholder}${placeholder && required ? ' *' : ''}`}
6060
clearable={false}
6161
/>
62-
<IconDown width="15" height="9" styleName="iconDropdown" />
62+
<img width="15" height="9" styleName="iconDropdown" src={iconDown} alt="dropdown-arraow-icon" />
6363
</div>
6464
{label ? (
6565
<span styleName="label">

src/shared/components/GUIKit/DropdownTerms/index.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import React, { useState, useRef, useEffect } from 'react';
66
import PT from 'prop-types';
77
import _ from 'lodash';
88
import { Creatable } from 'react-select';
9-
import IconDown from 'assets/images/minimal-down.svg';
9+
import iconDown from 'assets/images/dropdown-arrow.png';
1010
import './style.scss';
1111

1212
import { config } from 'topcoder-react-utils';
@@ -149,7 +149,7 @@ function DropdownTerms({
149149
internalTerms, t => !_.find(selectedOption, { label: t.label }),
150150
).map(o => ({ value: o.label, label: o.label }))}
151151
/>
152-
<IconDown width="15" height="9" styleName="iconDropdown" />
152+
<img width="15" height="9" styleName="iconDropdown" src={iconDown} alt="dropdown-arrow-icon" />
153153
</div>
154154
{label ? (
155155
<span styleName="label">

src/shared/components/GUIKit/SearchCombo/style.scss

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,9 @@
3030
z-index: 0;
3131
top: 8px;
3232
left: 15px;
33-
34-
@include xs-to-sm {
35-
max-width: 250px;
36-
overflow: hidden;
37-
white-space: nowrap;
38-
}
33+
overflow: hidden;
34+
white-space: nowrap;
35+
max-width: calc(100% - 20px);
3936
}
4037

4138
.clear-search {

src/shared/containers/Gigs/RecruitCRMJobs.jsx

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,22 @@ import LoadingIndicator from 'components/LoadingIndicator';
88
import SearchCombo from 'components/GUIKit/SearchCombo';
99
import Paginate from 'components/GUIKit/Paginate';
1010
import JobListCard from 'components/GUIKit/JobListCard';
11+
import Dropdown from 'components/GUIKit/Dropdown';
1112
import PT from 'prop-types';
1213
import React from 'react';
1314
import { connect } from 'react-redux';
1415
import './jobLisingStyles.scss';
1516

1617
const GIGS_PER_PAGE = 10;
18+
// Sort by dropdown
19+
const sortByOptions = [
20+
{ label: 'Latest Added Descending', selected: true },
21+
{ label: 'Latest Updated Descending', selected: false },
22+
];
23+
// Locations
24+
const locations = [{
25+
label: 'Anywhere', selected: true,
26+
}];
1727

1828
class RecruitCRMJobsContainer extends React.Component {
1929
constructor(props) {
@@ -23,11 +33,14 @@ class RecruitCRMJobsContainer extends React.Component {
2333
term: '',
2434
page: 0,
2535
sortBy: 'created_on',
36+
location: 'Anywhere',
2637
};
27-
38+
// binds
2839
this.onSearch = this.onSearch.bind(this);
2940
this.onPaginate = this.onPaginate.bind(this);
3041
this.onFilter = this.onFilter.bind(this);
42+
this.onLocation = this.onLocation.bind(this);
43+
this.onSort = this.onSort.bind(this);
3144
}
3245

3346
componentDidMount() {
@@ -69,6 +82,22 @@ class RecruitCRMJobsContainer extends React.Component {
6982
});
7083
}
7184

85+
onLocation(newLocation) {
86+
const selected = _.find(newLocation, { selected: true });
87+
this.onFilter({
88+
location: selected.label,
89+
page: 0,
90+
});
91+
}
92+
93+
onSort(newSort) {
94+
const selected = _.find(newSort, { selected: true });
95+
this.onFilter({
96+
sortBy: selected.label === 'Latest Updated Descending' ? 'updated_on' : 'created_on',
97+
page: 0,
98+
});
99+
}
100+
72101
render() {
73102
const {
74103
loading,
@@ -78,16 +107,29 @@ class RecruitCRMJobsContainer extends React.Component {
78107
term,
79108
page,
80109
sortBy,
110+
location,
81111
} = this.state;
82112

83113
if (loading) {
84114
return <LoadingIndicator />;
85115
}
86116

87117
let jobsToDisplay = jobs;
118+
// build current locations dropdown based on all data
119+
// and filter by selected location
120+
jobsToDisplay = _.filter(jobs, (job) => {
121+
// build dropdown
122+
const found = _.find(locations, { label: job.country });
123+
if (!found) {
124+
locations.push({ label: job.country, selected: location === job.country });
125+
}
126+
// filter
127+
if (location === 'Anywhere' || location === 'Any' || location === 'Any Location') return true;
128+
return location.toLowerCase() === job.country.toLowerCase();
129+
});
88130
// Filter by term
89131
if (term) {
90-
jobsToDisplay = _.filter(jobs, (job) => {
132+
jobsToDisplay = _.filter(jobsToDisplay, (job) => {
91133
// eslint-disable-next-line no-underscore-dangle
92134
const _term = term.toLowerCase();
93135
// name search
@@ -115,6 +157,8 @@ class RecruitCRMJobsContainer extends React.Component {
115157
<div styleName="container">
116158
<div styleName="filters">
117159
<SearchCombo placeholder="Search Gig Listings by Name, Skills, or Location" onSearch={this.onSearch} term={term} />
160+
<Dropdown label="Location" onChange={this.onLocation} options={locations} size="xs" />
161+
<Dropdown label="Sort by" onChange={this.onSort} options={sortByOptions} size="xs" />
118162
</div>
119163
<div styleName="jobs-list-container">
120164
{

src/shared/containers/Gigs/jobLisingStyles.scss

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,28 @@
1010

1111
.filters {
1212
display: flex;
13+
align-items: flex-end;
14+
15+
@include xs-to-sm {
16+
flex-direction: column;
17+
}
18+
19+
> div {
20+
margin-right: 30px;
21+
flex: 1;
22+
23+
@include xs-to-sm {
24+
margin-right: 0;
25+
}
26+
27+
&:first-child {
28+
flex: 3;
29+
}
30+
31+
&:last-child {
32+
margin-right: 0;
33+
}
34+
}
1335
}
1436

1537
.jobs-list-container {

0 commit comments

Comments
 (0)