Skip to content

Commit 97d263d

Browse files
committed
feat(web): style cases page, courts page
1 parent b9d1f53 commit 97d263d

File tree

5 files changed

+111
-56
lines changed

5 files changed

+111
-56
lines changed

web/src/components/CasesDisplay/Search.tsx

+31-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,30 @@
11
import React, { useMemo, useState } from "react";
2+
import styled, { css } from "styled-components";
3+
import { landscapeStyle } from "styles/landscapeStyle";
24
import { useNavigate, useParams } from "react-router-dom";
35
import { useDebounce } from "react-use";
4-
import styled from "styled-components";
56
import Skeleton from "react-loading-skeleton";
67
import { Searchbar, DropdownCascader } from "@kleros/ui-components-library";
78
import { rootCourtToItems, useCourtTree } from "queries/useCourtTree";
89
import { isUndefined } from "utils/index";
910
import { decodeURIFilter, encodeURIFilter, useRootPath } from "utils/uri";
1011

1112
const Container = styled.div`
13+
display: flex;
14+
flex-direction: column;
15+
gap: 4px;
16+
17+
${landscapeStyle(
18+
() =>
19+
css`
20+
flex-direction: row;
21+
gap: calc(4px + (24 - 4) * (min(max(100vw, 375px), 1250px) - 375px) / 875);
22+
`
23+
)}
24+
`;
25+
26+
const SearchBarContainer = styled.div`
27+
width: 100%;
1228
display: flex;
1329
flex-wrap: wrap;
1430
gap: 8px;
@@ -27,6 +43,15 @@ const StyledSearchbar = styled(Searchbar)`
2743
}
2844
`;
2945

46+
const StyledDropdownCascader = styled(DropdownCascader)`
47+
[class*="dropdown-container"] {
48+
width: 240px;
49+
}
50+
[class*="cascader"] {
51+
overflow: auto;
52+
}
53+
`;
54+
3055
const Search: React.FC = () => {
3156
const { page, order, filter } = useParams();
3257
const location = useRootPath();
@@ -54,17 +79,17 @@ const Search: React.FC = () => {
5479
}, [courtTreeData]);
5580

5681
return (
57-
<div>
58-
<Container>
82+
<Container>
83+
<SearchBarContainer>
5984
<StyledSearchbar
6085
type="text"
6186
placeholder="Search By ID"
6287
value={search}
6388
onChange={(e) => setSearch(e.target.value)}
6489
/>
65-
</Container>
90+
</SearchBarContainer>
6691
{items ? (
67-
<DropdownCascader
92+
<StyledDropdownCascader
6893
items={items}
6994
placeholder={"Select Court"}
7095
onSelect={(value) => {
@@ -76,7 +101,7 @@ const Search: React.FC = () => {
76101
) : (
77102
<Skeleton width={240} height={42} />
78103
)}
79-
</div>
104+
</Container>
80105
);
81106
};
82107

web/src/components/CasesDisplay/Stats.tsx

+7-3
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,17 @@ const FieldWrapper = styled.div`
77
`;
88

99
const SeparatorLabel = styled.label`
10-
margin-left: 8px;
11-
margin-right: 8px;
10+
margin: 0 8px;
11+
color: ${({ theme }) => theme.primaryText};
12+
`;
13+
14+
const StyledLabel = styled.label`
15+
color: ${({ theme }) => theme.primaryText};
1216
`;
1317

1418
const Field: React.FC<{ label: string; value: string }> = ({ label, value }) => (
1519
<FieldWrapper>
16-
<label>{label}</label>
20+
<StyledLabel>{label}</StyledLabel>
1721
<small>{value}</small>
1822
</FieldWrapper>
1923
);

web/src/components/CasesDisplay/StatsAndFilters.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ const Container = styled.div`
77
display: flex;
88
flex-wrap: wrap;
99
gap: 8px;
10-
margin-top: 8px;
10+
margin-top: 11px;
11+
justify-content: space-between;
1112
`;
1213

1314
const StatsAndFilters: React.FC<IStats> = ({ totalDisputes, closedDisputes }) => (

web/src/components/CasesDisplay/index.tsx

+12-5
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,16 @@ import Search from "./Search";
44
import StatsAndFilters from "./StatsAndFilters";
55
import CasesGrid, { ICasesGrid } from "./CasesGrid";
66

7-
const StyledHR = styled.hr`
8-
margin-top: 24px;
9-
margin-bottom: 24px;
7+
const Divider = styled.hr`
8+
display: flex;
9+
border: none;
10+
height: 1px;
11+
background-color: ${({ theme }) => theme.stroke};
12+
margin: calc(20px + (24 - 20) * (min(max(100vw, 375px), 1250px) - 375px) / 875) 0;
13+
`;
14+
15+
const StyledTitle = styled.h1`
16+
margin-bottom: calc(16px + (48 - 16) * (min(max(100vw, 375px), 1250px) - 375px) / 875);
1017
`;
1118

1219
interface ICasesDisplay extends ICasesGrid {
@@ -29,10 +36,10 @@ const CasesDisplay: React.FC<ICasesDisplay> = ({
2936
}) => {
3037
return (
3138
<div {...{ className }}>
32-
<h1>{title}</h1>
39+
<StyledTitle>{title}</StyledTitle>
3340
<Search />
3441
<StatsAndFilters totalDisputes={numberDisputes ?? 0} closedDisputes={numberClosedDisputes ?? 0} />
35-
<StyledHR />
42+
<Divider />
3643

3744
{disputes?.length === 0 ? (
3845
<h1>No cases found</h1>

web/src/pages/Courts/CourtDetails/index.tsx

+59-41
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,39 @@ import { usePnkFaucetWithdrewAlready, prepareWritePnkFaucet, usePnkBalanceOf } f
2323

2424
const Container = styled.div``;
2525

26+
const CourtHeader = styled.h1`
27+
display: flex;
28+
flex-direction: row;
29+
justify-content: space-between;
30+
gap: 24px;
31+
flex-wrap: wrap;
32+
`;
33+
34+
const CourtInfo = styled.div`
35+
display: flex:
36+
flex-direction: column;
37+
gap: 16px;
38+
39+
${landscapeStyle(
40+
() => css`
41+
gap: 32px;
42+
`
43+
)};
44+
`;
45+
2646
const ButtonContainer = styled.div`
2747
display: flex;
2848
flex-wrap: wrap;
29-
justify-content: space-between;
49+
flex-direction: column;
50+
align-items: flex-start;
51+
gap: 16px;
52+
53+
${landscapeStyle(
54+
() => css`
55+
align-items: flex-end;
56+
gap: 32px;
57+
`
58+
)};
3059
`;
3160

3261
const StyledCard = styled(Card)`
@@ -38,26 +67,13 @@ const StyledCard = styled(Card)`
3867
`;
3968

4069
const StyledBreadcrumb = styled(Breadcrumb)`
41-
margin-bottom: 12px;
4270
display: flex;
43-
align-items: flex-start;
71+
margin-top: 12px;
72+
align-items: center;
4473
`;
4574

4675
const StyledBreadcrumbSkeleton = styled.div`
47-
margin-bottom: 12px;
48-
`;
49-
50-
const CourtHeader = styled.h1`
51-
display: flex;
52-
flex-direction: column;
53-
gap: 16px;
54-
55-
${landscapeStyle(
56-
() => css`
57-
flex-direction: row;
58-
justify-content: space-between;
59-
`
60-
)}
76+
margin-top: 12px;
6177
`;
6278

6379
const CourtDetails: React.FC = () => {
@@ -108,31 +124,33 @@ const CourtDetails: React.FC = () => {
108124
<Container>
109125
<StyledCard>
110126
<CourtHeader>
111-
{policy ? policy.name : <StyledSkeleton width={200} />}
112-
<HowItWorks
113-
isMiniGuideOpen={isStakingMiniGuideOpen}
114-
toggleMiniGuide={toggleStakingMiniGuide}
115-
MiniGuideComponent={Staking}
116-
/>
117-
</CourtHeader>
118-
<ButtonContainer>
119-
{items.length > 1 ? (
120-
<StyledBreadcrumb items={items} />
121-
) : (
122-
<StyledBreadcrumbSkeleton>
123-
<StyledSkeleton width={100} />
124-
</StyledBreadcrumbSkeleton>
125-
)}
126-
{chain?.id === DEFAULT_CHAIN && !claimed && (
127-
<Button
128-
variant="primary"
129-
text={faucetCheck ? "Claim PNK" : "Empty Faucet"}
130-
onClick={handleRequest}
131-
isLoading={isSending}
132-
disabled={isSending || claimed || !faucetCheck}
127+
<CourtInfo>
128+
{policy ? policy.name : <StyledSkeleton width={200} />}
129+
{items.length > 1 ? (
130+
<StyledBreadcrumb items={items} />
131+
) : (
132+
<StyledBreadcrumbSkeleton>
133+
<StyledSkeleton width={100} />
134+
</StyledBreadcrumbSkeleton>
135+
)}
136+
</CourtInfo>
137+
<ButtonContainer>
138+
<HowItWorks
139+
isMiniGuideOpen={isStakingMiniGuideOpen}
140+
toggleMiniGuide={toggleStakingMiniGuide}
141+
MiniGuideComponent={Staking}
133142
/>
134-
)}
135-
</ButtonContainer>
143+
{chain?.id === DEFAULT_CHAIN && !claimed && (
144+
<Button
145+
variant="primary"
146+
text={faucetCheck ? "Claim PNK" : "Empty Faucet"}
147+
onClick={handleRequest}
148+
isLoading={isSending}
149+
disabled={isSending || claimed || !faucetCheck}
150+
/>
151+
)}
152+
</ButtonContainer>
153+
</CourtHeader>
136154
<hr />
137155
<Stats />
138156
<hr />

0 commit comments

Comments
 (0)