File tree Expand file tree Collapse file tree 5 files changed +70
-18
lines changed Expand file tree Collapse file tree 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 11import React from "react" ;
22import styled , { css } from "styled-components" ;
33
4- import { Breadcrumb } from "@kleros/ui-components-library" ;
5-
64import { 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" ;
79
810const Container = styled . div `
11+ display: flex;
912 width: 100%;
10- justify-content: flex-start;
13+ flex-direction: row;
14+ gap: 16px;
15+ align-items: center;
16+ justify-content: space-between;
1117
1218 small {
1319 height: 100%;
@@ -17,25 +23,46 @@ const Container = styled.div`
1723 ${ landscapeStyle (
1824 ( ) =>
1925 css `
26+ justify-content: flex-start;
2027 width: auto;
2128 `
2229 ) }
2330` ;
2431
25- const StyledBreadcrumb = styled ( Breadcrumb ) `
32+ const StyledButton = styled ( LightButton ) `
2633 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+ }
2947` ;
3048
3149interface ICourtName {
3250 name : string ;
51+ id : string ;
3352}
3453
35- const CourtName : React . FC < ICourtName > = ( { name } ) => {
54+ const CourtName : React . FC < ICourtName > = ( { name, id } ) => {
55+ const navigate = useNavigateAndScrollTop ( ) ;
56+
3657 return (
3758 < 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+ />
3966 </ Container >
4067 ) ;
4168} ;
Original file line number Diff line number Diff line change @@ -7,16 +7,18 @@ import { landscapeStyle } from "styles/landscapeStyle";
77
88import NumberDisplay from "components/NumberDisplay" ;
99
10+ import PnkIcon from "svgs/icons/pnk.svg" ;
11+
1012const Container = styled . div `
1113 display: flex;
1214 flex-direction: row;
1315 gap: 16px;
14- justify-content: space-between;
1516 width: 100%;
17+ justify-content: flex-start;
18+ align-items: center;
1619
1720 ${ landscapeStyle (
1821 ( ) => css `
19- justify-content: flex-end;
2022 width: auto;
2123 `
2224 ) }
@@ -31,6 +33,13 @@ const StyledLabel = styled.label`
3133 gap: 4px;
3234` ;
3335
36+ const StyledPnkIcon = styled ( PnkIcon ) `
37+ display: inline-block;
38+ width: 16px;
39+ height: 16px;
40+ fill: ${ ( { theme } ) => theme . secondaryPurple } ;
41+ ` ;
42+
3443interface IStake {
3544 stake : string ;
3645}
@@ -40,7 +49,7 @@ const Stake: React.FC<IStake> = ({ stake }) => {
4049
4150 return (
4251 < Container >
43- < label > Stake </ label >
52+ < StyledPnkIcon / >
4453 < StyledLabel >
4554 < NumberDisplay value = { formattedStake } unit = "PNK" />
4655 </ StyledLabel >
Original file line number Diff line number Diff line change @@ -15,31 +15,32 @@ const Container = styled(_Card)`
1515 justify-content: space-between;
1616 height: auto;
1717 width: 100%;
18- padding: 21px 24px 25px 19px ;
18+ padding: 21px 20px 25px 20px ;
1919 border-left: 5px solid ${ ( { theme } ) => theme . secondaryPurple } ;
2020 flex-wrap: wrap;
21- gap: 12px ;
21+ gap: 20px ;
2222
2323 ${ ( { theme } ) => ( theme . name === "light" ? `box-shadow: 0px 2px 3px 0px ${ theme . stroke } ;` : "" ) }
2424
2525 ${ landscapeStyle (
2626 ( ) =>
2727 css `
28- padding : 21.5px 32px 21.5 px 27 px ;
28+ padding : 21.5px 32px ;
2929 `
3030 ) }
3131` ;
3232
3333interface ICourtCard {
3434 name : string ;
3535 stake : string ;
36+ id : string ;
3637}
3738
38- const CourtCard : React . FC < ICourtCard > = ( { name, stake } ) => {
39+ const CourtCard : React . FC < ICourtCard > = ( { name, stake, id } ) => {
3940 return (
4041 < Container >
41- < CourtName name = { name } />
42- < Stake stake = { stake } />
42+ < CourtName { ... { name, id } } />
43+ < Stake { ... { stake } } />
4344 </ Container >
4445 ) ;
4546} ;
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ const Courts: React.FC = () => {
5454 { stakeData ?. jurorTokensPerCourts
5555 ?. filter ( ( { staked } ) => staked > 0 )
5656 . map ( ( { court : { id, name } , staked } ) => (
57- < CourtCard key = { id } name = { name ?? "" } stake = { staked } />
57+ < CourtCard key = { id } name = { name ?? "" } stake = { staked } { ... { id } } />
5858 ) ) }
5959 </ CourtCardsContainer >
6060 ) : null }
You can’t perform that action at this time.
0 commit comments