File tree 5 files changed +70
-18
lines changed
5 files changed +70
-18
lines changed Original file line number Diff line number Diff line change
1
+ import { useContext } from "react" ;
2
+ import { useNavigate } from "react-router-dom" ;
3
+ import { OverlayScrollContext } from "context/OverlayScrollContext" ;
4
+
5
+ export const useNavigateAndScrollTop = ( ) => {
6
+ const navigate = useNavigate ( ) ;
7
+ const osInstanceRef = useContext ( OverlayScrollContext ) ;
8
+
9
+ const navigateAndScrollTop = ( path ) => {
10
+ navigate ( path ) ;
11
+ osInstanceRef ?. current ?. osInstance ( ) . elements ( ) . viewport . scroll ( { top : 0 } ) ;
12
+ } ;
13
+
14
+ return navigateAndScrollTop ;
15
+ } ;
Original file line number Diff line number Diff line change 1
1
import React from "react" ;
2
2
import styled , { css } from "styled-components" ;
3
3
4
- import { Breadcrumb } from "@kleros/ui-components-library" ;
5
-
6
4
import { landscapeStyle } from "styles/landscapeStyle" ;
5
+ import LightButton from "components/LightButton" ;
6
+
7
+ import ArrowIcon from "svgs/icons/arrow.svg" ;
8
+ import { useNavigateAndScrollTop } from "hooks/useNavigateAndScrollTop" ;
7
9
8
10
const Container = styled . div `
11
+ display: flex;
9
12
width: 100%;
10
- justify-content: flex-start;
13
+ flex-direction: row;
14
+ gap: 16px;
15
+ align-items: center;
16
+ justify-content: space-between;
11
17
12
18
small {
13
19
height: 100%;
@@ -17,25 +23,46 @@ const Container = styled.div`
17
23
${ landscapeStyle (
18
24
( ) =>
19
25
css `
26
+ justify-content: flex-start;
20
27
width: auto;
21
28
`
22
29
) }
23
30
` ;
24
31
25
- const StyledBreadcrumb = styled ( Breadcrumb ) `
32
+ const StyledButton = styled ( LightButton ) `
26
33
display: flex;
27
- align-items: center;
28
- height: 100%;
34
+ flex-direction: row-reverse;
35
+ gap: 8px;
36
+ padding: 0px;
37
+ > .button-text {
38
+ color: ${ ( { theme } ) => theme . primaryBlue } ;
39
+ font-size: 14px;
40
+ }
41
+ > .button-svg {
42
+ margin-right: 0;
43
+ path {
44
+ fill: ${ ( { theme } ) => theme . primaryBlue } ;
45
+ }
46
+ }
29
47
` ;
30
48
31
49
interface ICourtName {
32
50
name : string ;
51
+ id : string ;
33
52
}
34
53
35
- const CourtName : React . FC < ICourtName > = ( { name } ) => {
54
+ const CourtName : React . FC < ICourtName > = ( { name, id } ) => {
55
+ const navigate = useNavigateAndScrollTop ( ) ;
56
+
36
57
return (
37
58
< Container >
38
- < StyledBreadcrumb items = { [ { text : name , value : 0 } ] } />
59
+ < small > { name } </ small >
60
+ < StyledButton
61
+ onClick = { ( ) => navigate ( `/courts/${ id ?. toString ( ) } ` ) }
62
+ text = "Open Court"
63
+ Icon = { ArrowIcon }
64
+ className = "reverse-button"
65
+ />
39
66
</ Container >
40
67
) ;
41
68
} ;
Original file line number Diff line number Diff line change @@ -7,16 +7,18 @@ import { landscapeStyle } from "styles/landscapeStyle";
7
7
8
8
import NumberDisplay from "components/NumberDisplay" ;
9
9
10
+ import PnkIcon from "svgs/icons/pnk.svg" ;
11
+
10
12
const Container = styled . div `
11
13
display: flex;
12
14
flex-direction: row;
13
15
gap: 16px;
14
- justify-content: space-between;
15
16
width: 100%;
17
+ justify-content: flex-start;
18
+ align-items: center;
16
19
17
20
${ landscapeStyle (
18
21
( ) => css `
19
- justify-content: flex-end;
20
22
width: auto;
21
23
`
22
24
) }
@@ -31,6 +33,13 @@ const StyledLabel = styled.label`
31
33
gap: 4px;
32
34
` ;
33
35
36
+ const StyledPnkIcon = styled ( PnkIcon ) `
37
+ display: inline-block;
38
+ width: 16px;
39
+ height: 16px;
40
+ fill: ${ ( { theme } ) => theme . secondaryPurple } ;
41
+ ` ;
42
+
34
43
interface IStake {
35
44
stake : string ;
36
45
}
@@ -40,7 +49,7 @@ const Stake: React.FC<IStake> = ({ stake }) => {
40
49
41
50
return (
42
51
< Container >
43
- < label > Stake </ label >
52
+ < StyledPnkIcon / >
44
53
< StyledLabel >
45
54
< NumberDisplay value = { formattedStake } unit = "PNK" />
46
55
</ StyledLabel >
Original file line number Diff line number Diff line change @@ -15,31 +15,32 @@ const Container = styled(_Card)`
15
15
justify-content: space-between;
16
16
height: auto;
17
17
width: 100%;
18
- padding: 21px 24px 25px 19px ;
18
+ padding: 21px 20px 25px 20px ;
19
19
border-left: 5px solid ${ ( { theme } ) => theme . secondaryPurple } ;
20
20
flex-wrap: wrap;
21
- gap: 12px ;
21
+ gap: 20px ;
22
22
23
23
${ ( { theme } ) => ( theme . name === "light" ? `box-shadow: 0px 2px 3px 0px ${ theme . stroke } ;` : "" ) }
24
24
25
25
${ landscapeStyle (
26
26
( ) =>
27
27
css `
28
- padding : 21.5px 32px 21.5 px 27 px ;
28
+ padding : 21.5px 32px ;
29
29
`
30
30
) }
31
31
` ;
32
32
33
33
interface ICourtCard {
34
34
name : string ;
35
35
stake : string ;
36
+ id : string ;
36
37
}
37
38
38
- const CourtCard : React . FC < ICourtCard > = ( { name, stake } ) => {
39
+ const CourtCard : React . FC < ICourtCard > = ( { name, stake, id } ) => {
39
40
return (
40
41
< Container >
41
- < CourtName name = { name } />
42
- < Stake stake = { stake } />
42
+ < CourtName { ... { name, id } } />
43
+ < Stake { ... { stake } } />
43
44
</ Container >
44
45
) ;
45
46
} ;
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ const Courts: React.FC = () => {
54
54
{ stakeData ?. jurorTokensPerCourts
55
55
?. filter ( ( { staked } ) => staked > 0 )
56
56
. map ( ( { court : { id, name } , staked } ) => (
57
- < CourtCard key = { id } name = { name ?? "" } stake = { staked } />
57
+ < CourtCard key = { id } name = { name ?? "" } stake = { staked } { ... { id } } />
58
58
) ) }
59
59
</ CourtCardsContainer >
60
60
) : null }
You can’t perform that action at this time.
0 commit comments