-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathindex.tsx
More file actions
80 lines (69 loc) · 1.86 KB
/
index.tsx
File metadata and controls
80 lines (69 loc) · 1.86 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
78
79
80
import React from "react";
import styled from "styled-components";
import { useLocation } from "react-router-dom";
import ArrowIcon from "svgs/icons/arrow.svg";
import { responsiveSize } from "styles/responsiveSize";
import CasesGrid, { ICasesGrid } from "./CasesGrid";
import Search from "./Search";
import StatsAndFilters from "./StatsAndFilters";
import { StyledArrowLink } from "../StyledArrowLink";
const TitleContainer = styled.div`
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
margin-bottom: ${responsiveSize(12, 24)};
`;
const StyledTitle = styled.h1`
margin: 0px;
`;
const StyledLabel = styled.label`
font-size: 16px;
`;
interface ICasesDisplay extends ICasesGrid {
numberDisputes?: number;
numberClosedDisputes?: number;
title?: string;
className?: string;
}
const CasesDisplay: React.FC<ICasesDisplay> = ({
disputes,
currentPage,
setCurrentPage,
numberDisputes,
numberClosedDisputes,
casesPerPage,
title = "Cases",
className,
totalPages,
}) => {
const location = useLocation();
return (
<div {...{ className }}>
<TitleContainer className="title">
<StyledTitle>{title}</StyledTitle>
{location.pathname.startsWith("/cases/display/1/desc/all") ? (
<StyledArrowLink to={"/resolver"}>
Create a case <ArrowIcon />
</StyledArrowLink>
) : null}
</TitleContainer>
<Search />
<StatsAndFilters totalDisputes={numberDisputes || 0} closedDisputes={numberClosedDisputes || 0} />
{disputes?.length === 0 ? (
<StyledLabel>No cases found</StyledLabel>
) : (
<CasesGrid
disputes={disputes}
{...{
casesPerPage,
totalPages,
currentPage,
setCurrentPage,
}}
/>
)}
</div>
);
};
export default CasesDisplay;