Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit cef072d

Browse files
authored
Merge pull request #345 from mbaghel/roles-finalfix
Roles finalfix challenge
2 parents 4cf54b4 + 9b376f0 commit cef072d

File tree

29 files changed

+436
-211
lines changed

29 files changed

+436
-211
lines changed

src/components/MonthPicker/index.jsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function getCurrMonthYear() {
1515
return new Date(`${year}-${month + 1}`);
1616
}
1717

18-
function MonthPicker({ name, value, onChange, onBlur }) {
18+
function MonthPicker({ name, value, onChange, onBlur, onFocus }) {
1919
return (
2020
<div styleName="month-picker">
2121
<DatePicker
@@ -26,6 +26,7 @@ function MonthPicker({ name, value, onChange, onBlur }) {
2626
showMonthYearPicker
2727
showPopperArrow={false}
2828
onBlur={onBlur}
29+
onFocus={onFocus}
2930
popperPlacement="top-end"
3031
showFourColumnMonthYearPicker
3132
minDate={getCurrMonthYear()}

src/components/NumberInput/index.jsx

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/**
2+
* Number Input
3+
* A custom number input to be used in forms
4+
* Removed default buttons and adds custom buttons
5+
*/
6+
import React from "react";
7+
import PT from "prop-types";
8+
import cn from "classnames";
9+
import "./styles.module.scss";
10+
11+
function NumberInput({ name, value, onChange, onBlur, onFocus, min, error }) {
12+
const incrementVal = (step) => {
13+
const newVal = +value + step;
14+
if (typeof newVal === "number" && !isNaN(newVal)) {
15+
onChange(newVal);
16+
}
17+
};
18+
const decrementVal = (step) => {
19+
const newVal = value - step;
20+
if (newVal >= min) {
21+
onChange(value - step);
22+
}
23+
};
24+
25+
return (
26+
<div styleName="container">
27+
<button styleName="left-button" onClick={() => decrementVal(1)}>
28+
29+
</button>
30+
<input
31+
styleName={cn("input", { error: error })}
32+
type="number"
33+
name={name}
34+
value={value}
35+
onChange={onChange}
36+
onBlur={onBlur}
37+
onFocus={onFocus}
38+
/>
39+
<button styleName="right-button" onClick={() => incrementVal(1)}>
40+
+
41+
</button>
42+
</div>
43+
);
44+
}
45+
46+
NumberInput.propTypes = {
47+
name: PT.string,
48+
value: PT.string,
49+
onChange: PT.func,
50+
onFocus: PT.func,
51+
onBlur: PT.func,
52+
min: PT.string,
53+
error: PT.bool,
54+
};
55+
56+
export default NumberInput;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
@import "styles/include";
2+
3+
// remove default buttons and style input as text input
4+
.input {
5+
appearance: textfield;
6+
text-align: center;
7+
8+
&.error {
9+
border-color: #fe665d;
10+
}
11+
}
12+
.input::-webkit-inner-spin-button,
13+
.input::-webkit-outer-spin-button {
14+
appearance: none;
15+
margin: 0;
16+
}
17+
18+
.container {
19+
position: relative;
20+
width: fit-content;
21+
}
22+
23+
.left-button,
24+
.right-button {
25+
@include font-roboto;
26+
font-size: 22px;
27+
color: #137D60;
28+
outline: none;
29+
border: none;
30+
background: none;
31+
position: absolute;
32+
top: 0;
33+
height: 100%;
34+
padding: 0 11px;
35+
}
36+
37+
.left-button {
38+
left: 0;
39+
}
40+
41+
.right-button {
42+
right: 0;
43+
}

src/constants/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ export const ACTION_TYPE = {
257257
CLEAR_SEARCHED_ROLES: "CLEAR_SEARCHED_ROLES",
258258
ADD_SEARCHED_ROLE: "ADD_SEARCHED_ROLE",
259259
ADD_ROLE_SEARCH_ID: "ADD_ROLE_SEARCH_ID",
260-
REPLACE_SEARCHED_ROLES: "REPLACE_SEARCHED_ROLES",
260+
DELETE_SEARCHED_ROLE: "DELETE_SEARCHED_ROLE",
261261
};
262262

263263
/**

src/root.component.jsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default function Root() {
2525
<Router>
2626
<Redirect from="/taas" to="/taas/myteams" exact />
2727
<MyTeamsList path="/taas/myteams" />
28-
<CreateNewTeam path="/taas/myteams/createnewteam" />
28+
<CreateNewTeam path="/taas/createnewteam" />
2929
<MyTeamsDetails path="/taas/myteams/:teamId" />
3030
<JobDetails path="/taas/myteams/:teamId/positions/:jobId" />
3131
<JobForm path="/taas/myteams/:teamId/positions/:jobId/edit" />
@@ -34,9 +34,9 @@ export default function Root() {
3434
<ResourceBookingForm path="/taas/myteams/:teamId/rb/:resourceBookingId/edit" />
3535
<PositionDetails path="/taas/myteams/:teamId/positions/:positionId/candidates" />
3636
<TeamAccess path="/taas/myteams/:teamId/access" />
37-
<InputJobDescription path="/taas/myteams/createnewteam/jd/*" />
38-
<InputSkills path="/taas/myteams/createnewteam/skills/*" />
39-
<SelectRole path="/taas/myteams/createnewteam/role/*" />
37+
<InputJobDescription path="/taas/createnewteam/jd/*" />
38+
<InputSkills path="/taas/createnewteam/skills/*" />
39+
<SelectRole path="/taas/createnewteam/role/*" />
4040
</Router>
4141

4242
{/* Global config for Toastr popups */}

src/routes/CreateNewTeam/actions/index.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ const addPreviousSearchId = (id) => ({
2222
payload: id,
2323
});
2424

25-
export const replaceSearchedRoles = (roles) => ({
26-
type: ACTION_TYPE.REPLACE_SEARCHED_ROLES,
27-
payload: { roles, lastRoleId: roles[roles.length - 1].searchId },
25+
const deleteRole = (id) => ({
26+
type: ACTION_TYPE.DELETE_SEARCHED_ROLE,
27+
payload: id,
2828
});
2929

3030
export const clearSearchedRoles = () => (dispatch, getState) => {
@@ -41,3 +41,8 @@ export const addRoleSearchId = (id) => (dispatch, getState) => {
4141
dispatch(addPreviousSearchId(id));
4242
updateLocalStorage(getState().searchedRoles);
4343
};
44+
45+
export const deleteSearchedRole = (id) => (dispatch, getState) => {
46+
dispatch(deleteRole(id));
47+
updateLocalStorage(getState().searchedRoles);
48+
};

src/routes/CreateNewTeam/components/AddedRolesAccordion/index.jsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ function AddedRolesAccordion({ addedRoles }) {
1919
<div styleName="heading">
2020
<h4 styleName="title">
2121
{addedRoles.length}{" "}
22-
{addedRoles.length > 1 ? "roles have" : "role has"} been added.
22+
{addedRoles.length > 1 ? "positions have" : "position has"} been
23+
added.
2324
</h4>
2425
</div>
2526
<div styleName={cn("arrow", { [isOpen ? "up" : "down"]: true })}></div>

src/routes/CreateNewTeam/components/ItemList/index.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function ItemList({
3737
<div styleName="item-list">
3838
<PageHeader
3939
title={title}
40-
backTo="/taas/myteams/createnewteam"
40+
backTo="/taas/createnewteam"
4141
aside={
4242
<>
4343
<Input

src/routes/CreateNewTeam/components/ItemList/styles.module.scss

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
margin-right: 20px;
88
position: relative;
99
height: 80vh;
10-
overflow-y: scroll;
10+
overflow-y: auto;
1111

1212
> header {
1313
padding: 16px 24px;
@@ -33,9 +33,9 @@ input:not([type="checkbox"]).filter-input {
3333
color: #2a2a2a;
3434
font-size: 14px;
3535
height: 40px;
36-
line-height: 38px;
36+
line-height: normal;
3737
outline: none;
38-
padding: 0 15px;
38+
padding: 8px 15px;
3939

4040
&:not(:focus) {
4141
background-image: url("../../../../assets/images/icon-search.svg");

src/routes/CreateNewTeam/components/NoMatchingProfilesResultCard/index.jsx

+8-2
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,20 @@ function NoMatchingProfilesResultCard({ role }) {
2525
We will be looking internally for members matching your requirements
2626
and be back at them in about 2 weeks.
2727
</p>
28-
{role && (
28+
{role.rates && role.name ? (
2929
<div styleName="niche-rate-box">
3030
<p>{role.name} Rate</p>
3131
<p styleName="cost">{formatMoney(role.rates[0].global)}</p>
3232
<p>/Week</p>
3333
</div>
34+
) : (
35+
<div styleName="niche-rate-box">
36+
<p>Custom Rate</p>
37+
<p styleName="cost">$1,200</p>
38+
<p>/Week</p>
39+
</div>
3440
)}
35-
<Link to="/taas/myteams/createnewteam">
41+
<Link to="/taas/createnewteam">
3642
<Button type="secondary" styleName="button">
3743
Modify Search Criteria
3844
</Button>

src/routes/CreateNewTeam/components/ResultCard/index.jsx

+9-2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ function ResultCard({ role }) {
3232
isExternalMember,
3333
skillsMatch,
3434
rates: [rates],
35+
jobTitle,
36+
name,
37+
timeToCandidate,
38+
timeToInterview,
3539
} = role;
3640
const [userHandle, setUserHandle] = useState(null);
3741
const [showRates, setShowRates] = useState(false);
@@ -54,6 +58,9 @@ function ResultCard({ role }) {
5458
<Curve styleName="curve" />
5559
<IconEarthCheck styleName="transparent-icon" />
5660
</div>
61+
<h4 styleName="job-title">
62+
{jobTitle && jobTitle.length ? jobTitle : name}
63+
</h4>
5764
<div styleName="button-group">
5865
<Button
5966
type={!showRates ? "segment-selected" : "segment"}
@@ -202,14 +209,14 @@ function ResultCard({ role }) {
202209
<IconMultipleActionsCheck />
203210
<div>
204211
<p>Qualified candidates within</p>
205-
<h6>24h</h6>
212+
<h6>{timeToCandidate}h</h6>
206213
</div>
207214
</div>
208215
<div styleName="timeline-info">
209216
<IconTeamMeetingChat />
210217
<div>
211218
<p>Interviews can start within</p>
212-
<h6>48h</h6>
219+
<h6>{timeToInterview}h</h6>
213220
</div>
214221
</div>
215222
</div>

src/routes/CreateNewTeam/components/ResultCard/styles.module.scss

+13-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
justify-content: flex-start;
1414
align-items: center;
1515
padding: 30px 0 60px 0;
16-
margin-bottom: 30px;
16+
margin-bottom: 14px;
1717
color: #fff;
1818
background-image: linear-gradient(225deg, #0ab88a 0%, #137d60 100%);
1919
position: relative;
@@ -40,6 +40,18 @@
4040
}
4141
}
4242

43+
.job-title {
44+
@include font-barlow;
45+
font-size: 22px;
46+
margin-bottom: 18px;
47+
font-weight: 600;
48+
text-align: center;
49+
text-transform: uppercase;
50+
// position text over bottom of header image
51+
position: relative;
52+
z-index: 100;
53+
}
54+
4355
.button-group {
4456
display: flex;
4557
flex-direction: row;

src/routes/CreateNewTeam/components/RoleDetailsModal/index.jsx

+15-13
Original file line numberDiff line numberDiff line change
@@ -90,19 +90,21 @@ function RoleDetailsModal({ roleId, open, onClose }) {
9090
Skills
9191
</Button>
9292
</div>
93-
{showSkills ? (
94-
<ul styleName="body skill-list">
95-
{skills.map((skill, i) => (
96-
<li styleName="skill-item" key={i}>
97-
{skill}
98-
</li>
99-
))}
100-
</ul>
101-
) : (
102-
<div styleName="markdown-container">
103-
<MarkdownViewer value={role?.description} />
104-
</div>
105-
)}
93+
<div styleName="content">
94+
{showSkills ? (
95+
<ul styleName="body skill-list">
96+
{skills.map((skill, i) => (
97+
<li styleName="skill-item" key={i}>
98+
{skill}
99+
</li>
100+
))}
101+
</ul>
102+
) : (
103+
<div styleName="markdown-container">
104+
<MarkdownViewer value={role?.description} />
105+
</div>
106+
)}
107+
</div>
106108
</div>
107109
</BaseCreateModal>
108110
);

src/routes/CreateNewTeam/components/RoleDetailsModal/styles.module.scss

+5
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,8 @@
5858
margin-bottom: 10px;
5959
font-size: 12px;
6060
}
61+
62+
.content {
63+
height: 180px;
64+
overflow-y: auto;
65+
}

0 commit comments

Comments
 (0)