File tree 5 files changed +61
-16
lines changed
5 files changed +61
-16
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;
11
16
12
17
small {
13
18
height: 100%;
@@ -17,25 +22,40 @@ const Container = styled.div`
17
22
${ landscapeStyle (
18
23
( ) =>
19
24
css `
25
+ justify-content: flex-start;
20
26
width: auto;
21
27
`
22
28
) }
23
29
` ;
24
30
25
- const StyledBreadcrumb = styled ( Breadcrumb ) `
31
+ const StyledButton = styled ( LightButton ) `
26
32
display: flex;
27
- align-items: center;
28
- height: 100%;
33
+ flex-direction: row-reverse;
34
+ gap: 8px;
35
+ padding: 0px;
36
+ > .button-text {
37
+ color: ${ ( { theme } ) => theme . primaryBlue } ;
38
+ font-size: 14px;
39
+ }
29
40
` ;
30
41
31
42
interface ICourtName {
32
43
name : string ;
44
+ id : string ;
33
45
}
34
46
35
- const CourtName : React . FC < ICourtName > = ( { name } ) => {
47
+ const CourtName : React . FC < ICourtName > = ( { name, id } ) => {
48
+ const navigate = useNavigateAndScrollTop ( ) ;
49
+
36
50
return (
37
51
< Container >
38
- < StyledBreadcrumb items = { [ { text : name , value : 0 } ] } />
52
+ < small > { name } </ small >
53
+ < StyledButton
54
+ onClick = { ( ) => navigate ( `/courts/${ id ?. toString ( ) } ` ) }
55
+ text = "Open Court"
56
+ Icon = { ArrowIcon }
57
+ className = "reverse-button"
58
+ />
39
59
</ Container >
40
60
) ;
41
61
} ;
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-end;
16
18
17
19
${ landscapeStyle (
18
20
( ) => css `
19
- justify-content: flex-end ;
21
+ align-items: center ;
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 @@ -18,7 +18,7 @@ const Container = styled(_Card)`
18
18
padding: 21px 24px 25px 19px;
19
19
border-left: 5px solid ${ ( { theme } ) => theme . secondaryPurple } ;
20
20
flex-wrap: wrap;
21
- gap: 12px ;
21
+ gap: 24px ;
22
22
23
23
${ ( { theme } ) => ( theme . name === "light" ? `box-shadow: 0px 2px 3px 0px ${ theme . stroke } ;` : "" ) }
24
24
@@ -33,13 +33,14 @@ const Container = styled(_Card)`
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