-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathDisputeListView.tsx
More file actions
77 lines (68 loc) · 2.01 KB
/
DisputeListView.tsx
File metadata and controls
77 lines (68 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import React from "react";
import styled from "styled-components";
import { Link } from "react-router-dom";
import { useAccount } from "wagmi";
import { Card } from "@kleros/ui-components-library";
import { Periods } from "consts/periods";
import { responsiveSize } from "styles/responsiveSize";
import { hoverShortTransitionTiming } from "styles/commonStyles";
import DisputeInfo from "./DisputeInfo";
import PeriodBanner from "./PeriodBanner";
const StyledListItem = styled(Card)`
${hoverShortTransitionTiming}
display: flex;
flex-grow: 1;
width: 100%;
height: 82px;
`;
const ListContainer = styled.div`
display: flex;
justify-content: space-between;
align-items: flex-start;
flex-grow: 1;
`;
const TitleContainer = styled.div<{ isLabel?: boolean }>`
display: flex;
height: 100%;
justify-content: start;
align-items: center;
width: ${({ isLabel }) => (isLabel ? responsiveSize(150, 340, 900) : "fit-content")};
h3 {
margin: 0;
}
`;
const TruncatedTitle = ({ text, maxLength }) => {
const truncatedText = text.length <= maxLength ? text : text.slice(0, maxLength) + "…";
return <h3>{truncatedText}</h3>;
};
interface IDisputeListView {
title: string;
disputeID?: string;
courtId?: string;
court?: string;
category?: string;
rewards?: string;
period?: Periods;
date?: number;
round?: number;
overrideIsList?: boolean;
isOverview?: boolean;
showLabels?: boolean;
}
const DisputeListView: React.FC<IDisputeListView> = (props) => {
const { isDisconnected } = useAccount();
return (
<Link to={`/cases/${props?.disputeID?.toString()}`}>
<StyledListItem hover>
<PeriodBanner isCard={false} id={parseInt(props?.disputeID ?? "0")} period={props.period} />
<ListContainer>
<TitleContainer isLabel={!isDisconnected}>
<TruncatedTitle text={props?.title} maxLength={50} />
</TitleContainer>
<DisputeInfo {...props} />
</ListContainer>
</StyledListItem>
</Link>
);
};
export default DisputeListView;