File tree Expand file tree Collapse file tree 5 files changed +61
-16
lines changed
Expand file tree Collapse file tree 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 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;
1116
1217 small {
1318 height: 100%;
@@ -17,25 +22,40 @@ const Container = styled.div`
1722 ${ landscapeStyle (
1823 ( ) =>
1924 css `
25+ justify-content: flex-start;
2026 width: auto;
2127 `
2228 ) }
2329` ;
2430
25- const StyledBreadcrumb = styled ( Breadcrumb ) `
31+ const StyledButton = styled ( LightButton ) `
2632 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+ }
2940` ;
3041
3142interface ICourtName {
3243 name : string ;
44+ id : string ;
3345}
3446
35- const CourtName : React . FC < ICourtName > = ( { name } ) => {
47+ const CourtName : React . FC < ICourtName > = ( { name, id } ) => {
48+ const navigate = useNavigateAndScrollTop ( ) ;
49+
3650 return (
3751 < 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+ />
3959 </ Container >
4060 ) ;
4161} ;
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-end;
1618
1719 ${ landscapeStyle (
1820 ( ) => css `
19- justify-content: flex-end ;
21+ align-items: center ;
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 @@ -18,7 +18,7 @@ const Container = styled(_Card)`
1818 padding: 21px 24px 25px 19px;
1919 border-left: 5px solid ${ ( { theme } ) => theme . secondaryPurple } ;
2020 flex-wrap: wrap;
21- gap: 12px ;
21+ gap: 24px ;
2222
2323 ${ ( { theme } ) => ( theme . name === "light" ? `box-shadow: 0px 2px 3px 0px ${ theme . stroke } ;` : "" ) }
2424
@@ -33,13 +33,14 @@ const Container = styled(_Card)`
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