Skip to content

Commit 36c3af4

Browse files
authored
Merge pull request #1809 from kleros/feat/ui-improvements
fix: better mobile margins, more hovers, cosmetic changes, slight bug…
2 parents f52ed9c + 2a1f4d0 commit 36c3af4

File tree

38 files changed

+322
-131
lines changed

38 files changed

+322
-131
lines changed

web/src/assets/svgs/icons/law-balance.svg

+1-1
Loading

web/src/components/DisputePreview/Policies.tsx

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import React from "react";
2-
import styled from "styled-components";
2+
import styled, { css } from "styled-components";
33

44
import PaperclipIcon from "svgs/icons/paperclip.svg";
55
import PolicyIcon from "svgs/icons/policy.svg";
66

77
import { getIpfsUrl } from "utils/getIpfsUrl";
88
import { isUndefined } from "utils/index";
99

10-
import { responsiveSize } from "styles/responsiveSize";
1110
import { hoverShortTransitionTiming } from "styles/commonStyles";
11+
import { landscapeStyle } from "styles/landscapeStyle";
1212

1313
import { InternalLink } from "components/InternalLink";
1414

@@ -17,9 +17,15 @@ const Container = styled.div`
1717
align-items: center;
1818
flex-direction: row;
1919
flex-wrap: wrap;
20-
gap: 8px 16px;
21-
padding: ${responsiveSize(12, 20)} ${responsiveSize(8, 32)};
20+
gap: 12px 16px;
21+
padding: 12px 16px 20px;
2222
background-color: ${({ theme }) => theme.mediumBlue};
23+
24+
${landscapeStyle(
25+
() => css`
26+
padding: 20px 32px;
27+
`
28+
)}
2329
`;
2430

2531
const StyledP = styled.p`

web/src/components/DisputeView/CardLabels/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const Container = styled.div<{ isList: boolean }>`
3030
${({ isList }) =>
3131
!isList &&
3232
css`
33-
margin-top: 16px;
33+
margin-top: 24px;
3434
width: 100%;
3535
flex-wrap: wrap;
3636
flex-direction: row;

web/src/components/DisputeView/DisputeCardView.tsx

+16-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import React from "react";
2-
import styled from "styled-components";
2+
import styled, { css } from "styled-components";
33

44
import { Link } from "react-router-dom";
55

66
import { Card } from "@kleros/ui-components-library";
77

88
import { Periods } from "consts/periods";
99

10-
import { responsiveSize } from "styles/responsiveSize";
1110
import { hoverShortTransitionTiming } from "styles/commonStyles";
11+
import { landscapeStyle } from "styles/landscapeStyle";
1212

1313
import { StyledSkeleton } from "components/StyledSkeleton";
1414

@@ -19,26 +19,36 @@ const StyledCard = styled(Card)`
1919
${hoverShortTransitionTiming}
2020
width: 100%;
2121
height: 100%;
22-
max-height: 335px;
2322
min-height: 290px;
2423
`;
2524

2625
const CardContainer = styled.div`
2726
height: calc(100% - 45px);
28-
padding: ${responsiveSize(20, 24)} ${responsiveSize(8, 24)};
27+
padding: 20px 16px;
2928
display: flex;
3029
flex-direction: column;
3130
justify-content: space-between;
31+
32+
${landscapeStyle(
33+
() => css`
34+
padding: 20px 24px;
35+
`
36+
)}
37+
`;
38+
39+
const StyledCaseCardTitle = styled.h3`
40+
margin-bottom: 20px;
3241
`;
3342

3443
const StyledCaseCardTitleSkeleton = styled(StyledSkeleton)`
35-
margin-bottom: 16px;
44+
margin-bottom: 20px;
3645
`;
3746

3847
const TruncatedTitle = ({ text, maxLength }) => {
3948
const truncatedText = text.length <= maxLength ? text : text.slice(0, maxLength) + "…";
40-
return <h3>{truncatedText}</h3>;
49+
return <StyledCaseCardTitle>{truncatedText}</StyledCaseCardTitle>;
4150
};
51+
4252
interface IDisputeCardView {
4353
title: string;
4454
disputeID?: string;

web/src/components/DisputeView/DisputeInfo/DisputeInfoCard.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { FieldItem, IDisputeInfo } from "./index";
1212
const Container = styled.div`
1313
display: flex;
1414
width: 100%;
15-
gap: 8px;
1615
flex-direction: column;
1716
justify-content: flex-end;
1817
`;

web/src/components/DisputeView/PeriodBanner.tsx

+8-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import styled, { Theme, css, useTheme } from "styled-components";
44
import { Periods } from "consts/periods";
55

66
import { responsiveSize } from "styles/responsiveSize";
7+
import { landscapeStyle } from "styles/landscapeStyle";
78

89
interface IContainer {
910
isCard: boolean;
@@ -20,14 +21,20 @@ const Container = styled.div<IContainer>`
2021
align-items: center;
2122
gap: 8px;
2223
justify-content: space-between;
23-
padding: 0 ${({ isCard }) => (isCard ? responsiveSize(8, 24) : responsiveSize(8, 24, 900))};
24+
padding: 0 ${({ isCard }) => (isCard ? "16px" : "24px")};
2425
flex-shrink: 0;
2526
${({ frontColor, backgroundColor, isCard }) => {
2627
return `
2728
${isCard ? `border-top: 5px solid ${frontColor}` : `border-left: 5px solid ${frontColor}`};
2829
${isCard && `background-color: ${backgroundColor};`};
2930
`;
3031
}};
32+
33+
${landscapeStyle(
34+
() => css`
35+
padding: 0 24px;
36+
`
37+
)}
3138
`;
3239

3340
const StyledLabel = styled.label<{ frontColor: string; withDot?: boolean; isCard?: boolean }>`

web/src/components/EvidenceCard.tsx

+15-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const StyledCard = styled(Card)`
3030
const TopContent = styled.div`
3131
display: flex;
3232
flex-direction: column;
33-
padding: ${responsiveSize(8, 20)} ${responsiveSize(8, 24)};
33+
padding: 16px;
3434
gap: 4px;
3535
overflow-wrap: break-word;
3636
@@ -45,6 +45,12 @@ const TopContent = styled.div`
4545
display: inline-block;
4646
margin: 0;
4747
}
48+
49+
${landscapeStyle(
50+
() => css`
51+
padding: 20px 24px;
52+
`
53+
)}
4854
`;
4955

5056
const IndexAndName = styled.div`
@@ -72,16 +78,23 @@ const StyledReactMarkdown = styled(ReactMarkdown)`
7278

7379
const BottomShade = styled.div`
7480
background-color: ${({ theme }) => theme.lightBlue};
81+
border-top: 1px solid ${({ theme }) => theme.stroke};
7582
display: flex;
7683
flex-wrap: wrap;
7784
align-items: center;
7885
justify-content: space-between;
79-
padding: 12px ${responsiveSize(8, 24)};
86+
padding: 16px;
8087
> * {
8188
flex-basis: 1;
8289
flex-shrink: 0;
8390
margin: 0;
8491
}
92+
93+
${landscapeStyle(
94+
() => css`
95+
padding: 16px 24px;
96+
`
97+
)}
8598
`;
8699

87100
const BottomLeftContent = styled.div`

web/src/components/FavoriteCases.tsx

+17-5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { isUndefined } from "utils/index";
99
import { DisputeDetailsFragment, useCasesQuery } from "queries/useCasesQuery";
1010

1111
import { responsiveSize } from "styles/responsiveSize";
12+
import { hoverShortTransitionTiming } from "styles/commonStyles";
1213

1314
import DisputeView from "components/DisputeView";
1415
import { SkeletonDisputeCard } from "components/StyledSkeleton";
@@ -18,7 +19,7 @@ const Container = styled.div`
1819
`;
1920

2021
const Title = styled.h1`
21-
margin-bottom: 4px;
22+
margin: 0;
2223
font-size: ${responsiveSize(20, 24)};
2324
`;
2425

@@ -30,11 +31,20 @@ const DisputeContainer = styled.div`
3031
gap: var(--gap);
3132
`;
3233

34+
const TitleAndClearLabel = styled.div`
35+
display: flex;
36+
flex-direction: row;
37+
gap: 12px;
38+
align-items: center;
39+
margin-bottom: ${responsiveSize(12, 24)};
40+
`;
41+
3342
const StyledLabel = styled.label`
34-
display: block;
43+
${hoverShortTransitionTiming}
3544
color: ${({ theme }) => theme.primaryBlue};
3645
cursor: pointer;
37-
margin-bottom: ${responsiveSize(12, 16)};
46+
margin-top: 6px;
47+
3848
:hover {
3949
color: ${({ theme }) => theme.secondaryBlue};
4050
}
@@ -61,8 +71,10 @@ const FavoriteCases: React.FC = () => {
6171

6272
return starredCaseIds.length > 0 && (isUndefined(disputes) || disputes.length > 0) ? (
6373
<Container>
64-
<Title>Favorite Cases</Title>
65-
<StyledLabel onClick={clearAll}>Clear all</StyledLabel>
74+
<TitleAndClearLabel>
75+
<Title>Favorite Cases</Title>
76+
<StyledLabel onClick={clearAll}>Clear all</StyledLabel>
77+
</TitleAndClearLabel>
6678
<DisputeContainer>
6779
{isUndefined(disputes)
6880
? Array.from({ length: 3 }).map((_, index) => <SkeletonDisputeCard key={index} />)

web/src/components/Verdict/FinalDecision.tsx

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useMemo } from "react";
2-
import styled from "styled-components";
2+
import styled, { css } from "styled-components";
33

44
import Skeleton from "react-loading-skeleton";
55
import { useParams } from "react-router-dom";
@@ -19,7 +19,7 @@ import { isUndefined } from "utils/index";
1919

2020
import { useDisputeDetailsQuery } from "queries/useDisputeDetailsQuery";
2121

22-
import { responsiveSize } from "styles/responsiveSize";
22+
import { landscapeStyle } from "styles/landscapeStyle";
2323

2424
import RulingAndRewardsIndicators from "./RulingAndRewardsIndicators";
2525
import AnswerDisplay from "./Answer";
@@ -35,7 +35,7 @@ const JuryContainer = styled.div`
3535
flex-direction: row;
3636
flex-wrap: wrap;
3737
align-items: center;
38-
gap: 4px 7px;
38+
gap: 5px 7px;
3939
4040
h3 {
4141
line-height: 21px;
@@ -48,7 +48,7 @@ const VerdictContainer = styled.div`
4848
flex-direction: row;
4949
align-items: center;
5050
flex-wrap: wrap;
51-
gap: ${responsiveSize(6, 8)};
51+
gap: 8px;
5252
`;
5353

5454
const JuryDecisionTag = styled.small`
@@ -57,7 +57,13 @@ const JuryDecisionTag = styled.small`
5757
`;
5858

5959
const StyledDivider = styled(Divider)`
60-
margin: ${responsiveSize(16, 24)} 0px;
60+
margin: 16px 0px;
61+
62+
${landscapeStyle(
63+
() => css`
64+
margin: 24px 0px;
65+
`
66+
)}
6167
`;
6268

6369
const ReStyledArrowLink = styled(StyledArrowLink)`

web/src/layout/Footer/index.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,22 @@ import LightButton from "components/LightButton";
1212
import { ExternalLink } from "components/ExternalLink";
1313

1414
const Container = styled.div`
15-
height: 122px;
15+
height: 114px;
1616
width: 100%;
1717
background-color: ${({ theme }) => (theme.name === "dark" ? theme.lightBlue : theme.primaryPurple)};
1818
display: flex;
1919
flex-direction: column;
2020
justify-content: center;
2121
align-items: center;
22-
padding: 0 32px 8px 32px;
23-
gap: 24px;
22+
padding: 8px;
23+
gap: 16px;
2424
2525
${landscapeStyle(
2626
() => css`
2727
height: 64px;
2828
flex-direction: row;
2929
justify-content: space-between;
30-
padding-bottom: 0;
30+
padding: 0 32px;
3131
`
3232
)}
3333
`;

web/src/pages/Cases/AttachmentDisplay/Header.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const StyledPaperClip = styled(PaperClip)`
3434
width: ${responsiveSize(16, 24)};
3535
height: ${responsiveSize(16, 24)};
3636
path {
37-
fill: ${({ theme }) => theme.primaryPurple};
37+
fill: ${({ theme }) => theme.secondaryPurple}B0;
3838
}
3939
`;
4040

web/src/pages/Cases/CaseDetails/Appeal/OptionCard.tsx

+17-10
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,32 @@
11
import React, { useMemo } from "react";
2-
import styled from "styled-components";
2+
import styled, { css } from "styled-components";
33

4-
import { responsiveSize } from "styles/responsiveSize";
54
import { hoverShortTransitionTiming } from "styles/commonStyles";
5+
import { landscapeStyle } from "styles/landscapeStyle";
6+
7+
import { Card, Radio, LinearProgress } from "@kleros/ui-components-library";
68

79
import { useMeasure } from "react-use";
810
import { formatEther } from "viem";
911

10-
import { Card, Radio, LinearProgress } from "@kleros/ui-components-library";
12+
import { isUndefined } from "utils/index";
1113

1214
import Gavel from "svgs/icons/gavel.svg";
1315

14-
import { isUndefined } from "utils/index";
15-
16-
const StyledCard = styled(Card)`
16+
const StyledCard = styled(Card)<{ canBeSelected: boolean }>`
1717
${hoverShortTransitionTiming}
1818
width: 100%;
19-
padding: ${responsiveSize(12, 24)} ${responsiveSize(8, 24)};
19+
padding: 16px;
2020
21-
&:hover {
22-
cursor: pointer;
21+
:hover {
22+
cursor: ${({ canBeSelected }) => (canBeSelected ? "pointer" : "auto")};
2323
}
24+
25+
${landscapeStyle(
26+
() => css`
27+
padding: 24px;
28+
`
29+
)}
2430
`;
2531

2632
const WinnerLabel = styled.label<{ winner: boolean }>`
@@ -97,8 +103,9 @@ const OptionCard: React.FC<IOptionCard> = ({
97103
else if (funding > 0n) return [`Funded with ${formatEther(funding)} ETH.`, 30];
98104
else return ["0 ETH contributed to this option", 0];
99105
}, [funding, required]);
106+
100107
return (
101-
<StyledCard ref={ref} hover {...props}>
108+
<StyledCard hover {...props} {...{ canBeSelected, ref }}>
102109
<TopContainer>
103110
<TextContainer>
104111
<BlockLabel>{text}</BlockLabel>

web/src/pages/Cases/CaseDetails/Appeal/index.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,13 @@ import AppealHistory from "./AppealHistory";
1313
import Classic from "./Classic";
1414

1515
const Container = styled.div`
16-
padding: ${responsiveSize(16, 32)} ${responsiveSize(8, 32)};
16+
padding: 16px;
17+
18+
${landscapeStyle(
19+
() => css`
20+
padding: 32px;
21+
`
22+
)}
1723
`;
1824

1925
export const AppealHeader = styled.div`

0 commit comments

Comments
 (0)