11import React from "react" ;
22import styled , { css } from "styled-components" ;
33
4+ import { landscapeStyle } from "styles/landscapeStyle" ;
5+
46import { Card as _Card } from "@kleros/ui-components-library" ;
57
6- import { landscapeStyle } from "styles/landscapeStyle" ;
8+ import ArrowIcon from "svgs/icons/arrow.svg" ;
9+ import NewTabIcon from "svgs/icons/new-tab.svg" ;
710
11+ import { formatDate } from "utils/date" ;
12+ import { getTxnExplorerLink } from "utils/index" ;
13+
14+ import { StyledArrowLink } from "components/StyledArrowLink" ;
815import CourtName from "./CourtName" ;
916import Stake from "./Stake" ;
1017
11- const Container = styled ( _Card ) `
18+ const Container = styled ( _Card ) < { isCurrentStakeCard ?: boolean } > `
1219 display: flex;
1320 flex-direction: row;
1421 align-items: center;
1522 justify-content: space-between;
1623 height: auto;
1724 width: 100%;
1825 padding: 20px 16px 24px;
19- border-left: 5px solid ${ ( { theme } ) => theme . secondaryPurple } ;
26+ border-left: 5px solid
27+ ${ ( { theme, isCurrentStakeCard } ) => ( isCurrentStakeCard ? theme . secondaryPurple : theme . secondaryText ) } ;
2028 flex-wrap: wrap;
2129 gap: 16px;
2230
@@ -28,22 +36,76 @@ const Container = styled(_Card)`
2836
2937 ${ landscapeStyle (
3038 ( ) => css `
31- padding : 21.5px 32 px ;
39+ padding: 21.5px 28px ;
3240 `
3341 ) }
3442` ;
3543
44+ const LeftContent = styled . div `
45+ display: flex;
46+ flex-direction: row;
47+ flex-wrap: wrap;
48+ gap: 16px 24px;
49+ ` ;
50+
51+ const StakeAndLinkAndDateContainer = styled . div `
52+ display: flex;
53+ flex-direction: row;
54+ flex-wrap: wrap;
55+ gap: 16px;
56+ ` ;
57+
58+ const StakeAndLink = styled . div `
59+ display: flex;
60+ flex-direction: row;
61+ gap: 8px;
62+ ` ;
63+
64+ const ReStyledArrowLink = styled ( StyledArrowLink ) `
65+ font-size: 14px;
66+
67+ > svg {
68+ height: 15px;
69+ width: 15px;
70+ }
71+ ` ;
72+
3673interface ICourtCard {
3774 name : string ;
3875 stake : string ;
3976 id : string ;
77+ timestamp ?: number ;
78+ transactionHash ?: string ;
79+ isCurrentStakeCard ?: boolean ;
4080}
4181
42- const CourtCard : React . FC < ICourtCard > = ( { name, stake, id } ) => {
82+ const CourtCard : React . FC < ICourtCard > = ( {
83+ name,
84+ stake,
85+ id,
86+ timestamp,
87+ transactionHash,
88+ isCurrentStakeCard = true ,
89+ } ) => {
4390 return (
44- < Container hover >
45- < CourtName { ...{ name, id } } />
46- < Stake { ...{ stake } } />
91+ < Container hover { ...{ isCurrentStakeCard } } >
92+ < LeftContent >
93+ < CourtName { ...{ name, id } } />
94+ < StakeAndLinkAndDateContainer >
95+ < StakeAndLink >
96+ < Stake { ...{ stake } } />
97+ { transactionHash ? (
98+ < ReStyledArrowLink to = { getTxnExplorerLink ( transactionHash ) } target = "_blank" rel = "noopener noreferrer" >
99+ < NewTabIcon />
100+ </ ReStyledArrowLink >
101+ ) : null }
102+ </ StakeAndLink >
103+ { timestamp ? < label > { formatDate ( timestamp ) } </ label > : null }
104+ </ StakeAndLinkAndDateContainer >
105+ </ LeftContent >
106+ < ReStyledArrowLink to = { `/courts/${ id ?. toString ( ) } ` } >
107+ Open Court < ArrowIcon />
108+ </ ReStyledArrowLink >
47109 </ Container >
48110 ) ;
49111} ;
0 commit comments