Skip to content

Commit 1350ee8

Browse files
committed
improvement(reskin): element style fixes - part 2 f2f
1 parent 50944e1 commit 1350ee8

File tree

12 files changed

+81
-29
lines changed

12 files changed

+81
-29
lines changed

__tests__/shared/components/challenge-listing/__snapshots__/LeaderboardAvatar.jsx.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ exports[`Matches shallow shapshot 1`] = `
3030
}
3131
}
3232
onClick={null}
33+
plusOne={false}
3334
url="url"
3435
/>
3536
</Router>

src/assets/images/tooltip-arrow.svg

Lines changed: 3 additions & 0 deletions
Loading

src/shared/components/Tooltip/style.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
.rc-tooltip-placement-topLeft .rc-tooltip-arrow,
1818
.rc-tooltip-placement-topRight .rc-tooltip-arrow {
1919
border-top-color: $tc-gray-80;
20+
background: url(assets/images/tooltip-arrow.svg);
2021
}
2122

2223
.rc-tooltip-placement-right .rc-tooltip-arrow,

src/shared/components/challenge-listing/ChallengeCard/Prize/Tip/style.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ $prize-space-10: $base-unit * 2;
77
max-width: 480px;
88
padding: 10px 10px 0 10px;
99
overflow: hidden;
10+
background-color: #2a2a2a;
11+
border-radius: 8px;
1012

1113
.bonuses {
1214
border-top: 1px solid $tc-gray-70;

src/shared/components/challenge-listing/ChallengeCard/Prize/index.jsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ export default function Prize({
3535
</div>
3636
);
3737

38+
function placeArrow(TooltipNode) {
39+
const arrow = TooltipNode.querySelector('.rc-tooltip-arrow');
40+
arrow.style.left = '33%';
41+
}
42+
3843
const component = (
3944
<div
4045
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
@@ -43,7 +48,7 @@ export default function Prize({
4348
>
4449
{((onlyShowTooltipForPrize && !withoutTooltip)
4550
? (
46-
<Tooltip content={tip}>
51+
<Tooltip content={tip} placeArrow={placeArrow}>
4752
{prizeUI}
4853
</Tooltip>
4954
)

src/shared/components/challenge-listing/ChallengeCard/Status/index.jsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,24 @@ export default function ChallengeStatus(props) {
8989
winners = winners.slice(0, MAX_VISIBLE_WINNERS);
9090
winners.push(lastItem);
9191
}
92+
9293
const leaderboard = winners && winners.map((winner) => {
9394
if (winner.isLastItem) {
9495
return (
9596
/* TODO: No, should not reuse avatar for displaying "+1" in
9697
* a circle. Should be a separate component for that. */
97-
<LeaderboardAvatar
98-
key={winner.handle}
99-
member={winner}
100-
onClick={() => (
101-
setImmediate(() => selectChallengeDetailsTab(DETAIL_TABS.WINNERS))
102-
)}
103-
openNewTab={openChallengesInNewTabs}
104-
url={detailLink}
105-
plusOne
106-
/>
98+
<div styleName="avatar-container" key={winner.handle}>
99+
<LeaderboardAvatar
100+
key={winner.handle}
101+
member={winner}
102+
onClick={() => (
103+
setImmediate(() => selectChallengeDetailsTab(DETAIL_TABS.WINNERS))
104+
)}
105+
openNewTab={openChallengesInNewTabs}
106+
url={`${detailLink}?tab=winners`}
107+
plusOne
108+
/>
109+
</div>
107110
);
108111
}
109112
const userProfile = getProfile(winner);

src/shared/components/challenge-listing/ChallengeCard/Status/style.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,12 @@ $status-radius-4: $corner-radius * 2;
4545
}
4646

4747
.avatar-container {
48-
margin-right: 30px;
48+
margin-right: 0;
49+
margin-left: 10px;
4950

5051
@include xl {
51-
margin-right: 30px;
52+
margin-right: 0;
53+
margin-left: 10px;
5254
}
5355

5456
> span {

src/shared/components/challenge-listing/LeaderboardAvatar/index.jsx

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class LeaderboardAvatar extends Component {
1818

1919
render() {
2020
const {
21-
onClick, url,
21+
onClick, plusOne, url,
2222
} = this.props;
2323
const { member } = this.state;
2424
const targetURL = url || `${window.origin}/members/${member.handle}`;
@@ -40,9 +40,19 @@ class LeaderboardAvatar extends Component {
4040
openNewTab={!_.includes(window.origin, 'www')}
4141
styleName={`leaderboard-avatar ${member.position || member.isSmr ? '' : 'light-gray'}`}
4242
>
43-
<span styleName={member.position ? `placement placement-${member.position}` : 'hidden'}>
44-
{formatOrdinals(member.position)}
45-
</span>
43+
{ plusOne
44+
? (
45+
<div>
46+
<div>
47+
<span styleName="plus">{member.handle}</span>
48+
</div>
49+
</div>
50+
) : (
51+
<span styleName={member.position ? `placement placement-${member.position}` : 'hidden'}>
52+
{formatOrdinals(member.position)}
53+
</span>
54+
)
55+
}
4656
</Link>
4757
);
4858
}
@@ -51,14 +61,14 @@ class LeaderboardAvatar extends Component {
5161
LeaderboardAvatar.defaultProps = {
5262
member: {},
5363
onClick: null,
54-
// plusOne: false,
64+
plusOne: false,
5565
url: '',
5666
};
5767

5868
LeaderboardAvatar.propTypes = {
5969
member: PT.shape({}),
6070
onClick: PT.func,
61-
// plusOne: PT.bool,
71+
plusOne: PT.bool,
6272
url: PT.string,
6373
};
6474

src/shared/components/challenge-listing/LeaderboardAvatar/style.scss

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,25 @@ $leader-radius-4: $corner-radius * 2;
3333
}
3434
}
3535

36+
.plus {
37+
@include roboto-medium;
38+
39+
width: 25px;
40+
height: 25px;
41+
background-color: #e0faf3;
42+
font-size: 11px;
43+
color: #2a2a2a;
44+
font-weight: 500;
45+
border-radius: $leader-radius-50;
46+
display: flex;
47+
align-self: center;
48+
justify-content: center;
49+
flex-direction: column;
50+
margin-left: 0;
51+
padding: 4px;
52+
}
53+
3654
.placement {
37-
position: absolute;
3855
display: flex;
3956
width: 24px;
4057
height: 24px;

src/shared/components/challenge-listing/Tooltips/ProgressBarTooltip/index.jsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,6 @@ function placeArrow(TooltipNode) {
192192
if (rootTopOffset < tooltipTopOffset) {
193193
toolTip.style.top = `${parseInt(toolTip.style.top, 10) - 20}px`;
194194
arrow.style.top = '-5px';
195-
} else {
196-
arrow.style.top = '100%';
197195
}
198196
}
199197

src/shared/components/challenge-listing/Tooltips/ProgressBarTooltip/style.scss

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,27 @@ $tip-space-95: $base-unit * 19;
88
$tip-radius-15: $corner-radius * 7 + 1;
99
$tip-radius-4: $corner-radius * 2;
1010

11+
:global {
12+
.rc-tooltip-arrow {
13+
background-color: url(assets/images/tooltip-arrow.svg);
14+
width: 30px;
15+
height: 9px;
16+
position: absolute;
17+
left: 41% !important;
18+
z-index: 10000;
19+
bottom: 0 !important;
20+
border: 0;
21+
}
22+
}
23+
1124
div.progress-bar-tooltip {
1225
@include roboto-regular;
1326

1427
color: $tc-white;
1528
max-width: none;
1629
padding: 0 $base-unit * 3;
17-
background-color: #2a2a2a;
18-
19-
.rc-tooltip-inner {
20-
padding: 0 $base-unit * 3;
21-
border-radius: 8px;
22-
}
30+
background-color: #2a2a2a !important;
31+
border-radius: 8px;
2332

2433
.tip {
2534
word-wrap: none;

src/shared/components/challenge-listing/Tooltips/UserAvatarTooltip/style.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ $avatar-radius-4: $corner-radius * 2;
1616
max-width: 640px;
1717
overflow: auto;
1818
padding: 10px;
19-
background-color: linear-gradient(0deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)), #2a2a2a;
19+
background-color: #2a2a2a;
20+
border-radius: 8px;
2021

2122
.achievements {
2223
border-top: 1px solid $tc-gray-70;

0 commit comments

Comments
 (0)