File tree Expand file tree Collapse file tree 12 files changed +81
-29
lines changed
__tests__/shared/components/challenge-listing/__snapshots__ Expand file tree Collapse file tree 12 files changed +81
-29
lines changed Original file line number Diff line number Diff 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 >
Original file line number Diff line number Diff line change 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 ,
Original file line number Diff line number Diff 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 ;
Original file line number Diff line number Diff 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 )
Original file line number Diff line number Diff 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 ) ;
Original file line number Diff line number Diff 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 {
Original file line number Diff line number Diff 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 {
5161LeaderboardAvatar . defaultProps = {
5262 member : { } ,
5363 onClick : null ,
54- // plusOne: false,
64+ plusOne : false ,
5565 url : '' ,
5666} ;
5767
5868LeaderboardAvatar . propTypes = {
5969 member : PT . shape ( { } ) ,
6070 onClick : PT . func ,
61- // plusOne: PT.bool,
71+ plusOne : PT . bool ,
6272 url : PT . string ,
6373} ;
6474
Original file line number Diff line number Diff 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 ;
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments