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

Commit 64e0af5

Browse files
committed
Change matching rate to skills match. Add tooltip icon next to 'Add Start Month' in team description popup
1 parent 703fb73 commit 64e0af5

File tree

6 files changed

+167
-19
lines changed

6 files changed

+167
-19
lines changed
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/**
2+
* Information Tooltip
3+
* Icon which reveals a tooltip on mouse hover
4+
*/
5+
import React, { useCallback, useState } from "react";
6+
import PT from "prop-types";
7+
import { usePopper } from "react-popper";
8+
import IconInformationCircle from "../../assets/images/icon-information-circle.svg";
9+
import "./styles.module.scss";
10+
11+
function InformationTooltip({ text, iconSize = "16px" }) {
12+
const [isTooltipShown, setIsTooltipShown] = useState(false);
13+
const [referenceElement, setReferenceElement] = useState(null);
14+
const [popperElement, setPopperElement] = useState(null);
15+
const [arrowElement, setArrowElement] = useState(null);
16+
const { styles, attributes } = usePopper(referenceElement, popperElement, {
17+
placement: "top",
18+
modifiers: [
19+
{
20+
name: "flip",
21+
options: {
22+
fallbackPlacements: ["top"],
23+
},
24+
},
25+
{
26+
name: "offset",
27+
options: {
28+
// use offset to move the tooltip slightly up
29+
offset: [0, 10],
30+
},
31+
},
32+
{
33+
name: "arrow",
34+
// padding should be equal to border-radius of the tooltip
35+
options: { element: arrowElement, padding: 8 },
36+
},
37+
],
38+
});
39+
40+
const showTooltip = useCallback(() => {
41+
setIsTooltipShown(true);
42+
}, [setIsTooltipShown]);
43+
44+
const hideTooltip = useCallback(() => {
45+
setIsTooltipShown(false);
46+
}, [setIsTooltipShown]);
47+
48+
const iconStyle = {
49+
width: iconSize,
50+
height: iconSize,
51+
};
52+
53+
return (
54+
<div>
55+
<div
56+
style={iconStyle}
57+
ref={setReferenceElement}
58+
onMouseEnter={showTooltip}
59+
onMouseLeave={hideTooltip}
60+
>
61+
<IconInformationCircle styleName="circle" />
62+
</div>
63+
{isTooltipShown && (
64+
<div
65+
styleName="tooltip"
66+
ref={setPopperElement}
67+
style={styles.popper}
68+
{...attributes.popper}
69+
>
70+
<div styleName="tooltip-content">{text}</div>
71+
<div
72+
styleName="tooltip-arrow"
73+
ref={setArrowElement}
74+
style={styles.arrow}
75+
/>
76+
</div>
77+
)}
78+
</div>
79+
);
80+
}
81+
82+
InformationTooltip.propTypes = {
83+
iconSize: PT.string,
84+
text: PT.string,
85+
};
86+
87+
export default InformationTooltip;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
@import "styles/include";
2+
3+
.circle {
4+
* {
5+
fill: #aaa;
6+
}
7+
}
8+
9+
.tooltip {
10+
border-radius: 5px;
11+
box-shadow: 0px 5px 25px #c6c6c6;
12+
width: 165px;
13+
z-index: 1000;
14+
}
15+
16+
.tooltip-arrow {
17+
bottom: -9px;
18+
border-style: solid;
19+
border-width: 10px 8px 0 8px;
20+
border-color: #2a2a2a transparent transparent transparent;
21+
height: 0;
22+
width: 0;
23+
}
24+
25+
.tooltip-content {
26+
border-radius: 5px;
27+
@include font-roboto;
28+
font-size: 12px;
29+
line-height: 16px;
30+
font-weight: 400;
31+
color: #fff;
32+
background-color: #2a2a2a;
33+
padding: 10px;
34+
}

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

+6-7
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import IconTeamMeetingChat from "../../../../assets/images/icon-team-meeting-cha
1515
import Curve from "../../../../assets/images/curve.svg";
1616
import CircularProgressBar from "../CircularProgressBar";
1717
import Button from "components/Button";
18-
import { MATCHING_RATE } from "constants";
1918
import { formatMoney } from "utils/format";
2019

2120
function formatRate(value) {
@@ -31,7 +30,7 @@ function ResultCard({ role }) {
3130
const {
3231
numberOfMembersAvailable,
3332
isExternalMember,
34-
matchingRate,
33+
skillsMatch,
3534
rates: [rates],
3635
} = role;
3736
const [userHandle, setUserHandle] = useState(null);
@@ -49,8 +48,8 @@ function ResultCard({ role }) {
4948
<IconEarthCheck />
5049
<h3>We have matching profiles</h3>
5150
<p>
52-
We have qualified candidates who match {formatPercent(matchingRate)}
53-
{matchingRate < 1 ? " or more " : " "} of your job requirements.
51+
We have qualified candidates who match {formatPercent(skillsMatch)}
52+
{skillsMatch < 1 ? " or more " : " "} of your job requirements.
5453
</p>
5554
<Curve styleName="curve" />
5655
<IconEarthCheck styleName="transparent-icon" />
@@ -222,12 +221,12 @@ function ResultCard({ role }) {
222221
<div>
223222
<CircularProgressBar
224223
size="160"
225-
progress={matchingRate}
224+
progress={skillsMatch}
226225
strokeWidth="6"
227226
children={
228227
<div styleName="progressbar-child">
229-
<h4>{formatPercent(matchingRate)}</h4>
230-
<p>Matching rate</p>
228+
<h4>{formatPercent(skillsMatch)}</h4>
229+
<p>Skills Match</p>
231230
</div>
232231
}
233232
/>

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

+19-12
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { formatPlural } from "utils/format";
1313
import Button from "components/Button";
1414
import "./styles.module.scss";
1515
import DatePicker from "react-datepicker";
16+
import InformationTooltip from "components/InformationTooltip";
1617

1718
const Error = ({ name }) => {
1819
const {
@@ -192,7 +193,7 @@ function TeamDetailsModal({ open, onClose, submitForm, addedRoles }) {
192193
/>
193194
<Error name={`${id}.durationWeeks`} />
194195
</td>
195-
<td>
196+
<td styleName="start-month">
196197
{startMonthVisible[id] ? (
197198
<>
198199
<Field
@@ -214,17 +215,23 @@ function TeamDetailsModal({ open, onClose, submitForm, addedRoles }) {
214215
<Error name={`${id}.startMonth`} />
215216
</>
216217
) : (
217-
<button
218-
styleName="toggle-button"
219-
onClick={() =>
220-
setStartMonthVisible((prevState) => ({
221-
...prevState,
222-
[id]: true,
223-
}))
224-
}
225-
>
226-
Add Start Month
227-
</button>
218+
<div styleName="flex-container">
219+
<button
220+
styleName="toggle-button"
221+
onClick={() =>
222+
setStartMonthVisible((prevState) => ({
223+
...prevState,
224+
[id]: true,
225+
}))
226+
}
227+
>
228+
Add Start Month
229+
</button>
230+
<InformationTooltip
231+
iconSize="14px"
232+
text="Requested start month for this position."
233+
/>
234+
</div>
228235
)}
229236
</td>
230237
</tr>

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

+11
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@
4242
color: #2a2a2a;
4343
border-bottom: 1px solid #e9e9e9;
4444

45+
&.start-month {
46+
padding-right: 0;
47+
}
48+
4549
input {
4650
@include font-roboto;
4751
font-size: 14px;
@@ -56,6 +60,13 @@
5660
}
5761
}
5862

63+
.flex-container {
64+
display: flex;
65+
flex-direction: row;
66+
align-items: center;
67+
justify-content: flex-start;
68+
}
69+
5970
.error {
6071
font-size: 14px;
6172
font-weight: 400;

0 commit comments

Comments
 (0)