Skip to content

Commit 872c9de

Browse files
committed
feat: new design in court page, statdisplay refactor, stylings
1 parent 79aa34a commit 872c9de

File tree

8 files changed

+187
-274
lines changed

8 files changed

+187
-274
lines changed

web/src/components/StatDisplay.tsx

+59-26
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,63 @@
11
import React from "react";
22
import styled, { useTheme, css } from "styled-components";
33

4-
import { landscapeStyle } from "styles/landscapeStyle";
5-
import { responsiveSize } from "styles/responsiveSize";
6-
7-
const Container = styled.div`
4+
const Container = styled.div<{ isSmallDisplay: boolean }>`
85
display: flex;
9-
max-width: 196px;
106
align-items: center;
117
gap: 8px;
12-
13-
${landscapeStyle(
14-
() => css`
15-
margin-bottom: ${responsiveSize(16, 30)};
16-
`
17-
)}
8+
${({ isSmallDisplay }) =>
9+
isSmallDisplay
10+
? css`
11+
width: 151px;
12+
`
13+
: css`
14+
max-width: 196px;
15+
`}
1816
`;
1917

20-
const SVGContainer = styled.div<{ iconColor: string; backgroundColor: string }>`
21-
height: 48px;
22-
width: 48px;
18+
const SVGContainer = styled.div<{ iconColor: string; backgroundColor: string; isSmallDisplay: boolean }>`
2319
border-radius: 50%;
24-
background-color: ${({ backgroundColor }) => backgroundColor};
2520
display: flex;
2621
align-items: center;
2722
justify-content: center;
23+
background-color: ${({ backgroundColor }) => backgroundColor};
2824
svg {
2925
fill: ${({ iconColor }) => iconColor};
3026
}
27+
28+
${({ isSmallDisplay }) =>
29+
isSmallDisplay
30+
? css`
31+
height: 32px;
32+
width: 32px;
33+
svg {
34+
height: 20px;
35+
}
36+
`
37+
: css`
38+
height: 48px;
39+
width: 48px;
40+
`}
3141
`;
3242

33-
const TextContainer = styled.div`
34-
h1 {
35-
margin: 0;
36-
}
43+
const TextContainer = styled.div<{ isSmallDisplay: boolean }>`
44+
display: flex;
45+
flex-direction: column;
46+
gap: ${({ isSmallDisplay }) => (isSmallDisplay ? "3px" : "8px")};
47+
`;
48+
49+
const StyledTitle = styled.label`
50+
font-size: 14px;
51+
`;
52+
53+
const StyledValue = styled.label<{ isSmallDisplay: boolean }>`
54+
font-size: ${({ isSmallDisplay }) => (isSmallDisplay ? "16px" : "24px")};
55+
font-weight: 600;
56+
color: ${({ theme }) => theme.primaryText};
57+
`;
58+
59+
const StyledUSDValue = styled.label<{ isSmallDisplay: boolean }>`
60+
font-size: ${({ isSmallDisplay }) => (isSmallDisplay ? "12px" : "14px")};
3761
`;
3862

3963
const createPair = (iconColor: string, backgroundColor: string) => ({
@@ -47,9 +71,18 @@ export interface IStatDisplay {
4771
subtext?: string | React.ReactNode;
4872
icon: React.FunctionComponent<React.SVGAttributes<SVGElement>>;
4973
color: "red" | "orange" | "green" | "blue" | "purple";
74+
isSmallDisplay?: boolean;
5075
}
5176

52-
const StatDisplay: React.FC<IStatDisplay> = ({ title, text, subtext, icon: Icon, color, ...props }) => {
77+
const StatDisplay: React.FC<IStatDisplay> = ({
78+
title,
79+
text,
80+
subtext,
81+
icon: Icon,
82+
color,
83+
isSmallDisplay = false,
84+
...props
85+
}) => {
5386
const theme = useTheme();
5487
const COLORS = {
5588
red: createPair(theme.error, theme.errorLight),
@@ -60,12 +93,12 @@ const StatDisplay: React.FC<IStatDisplay> = ({ title, text, subtext, icon: Icon,
6093
};
6194

6295
return (
63-
<Container {...props}>
64-
<SVGContainer {...{ ...COLORS[color] }}>{<Icon />}</SVGContainer>
65-
<TextContainer>
66-
<label>{title}</label>
67-
<h1>{text}</h1>
68-
<label>{subtext}</label>
96+
<Container {...{ isSmallDisplay }} {...props}>
97+
<SVGContainer {...{ ...COLORS[color], isSmallDisplay }}>{<Icon />}</SVGContainer>
98+
<TextContainer {...{ isSmallDisplay }}>
99+
<StyledTitle>{title}</StyledTitle>
100+
<StyledValue {...{ isSmallDisplay }}>{text}</StyledValue>
101+
<StyledUSDValue {...{ isSmallDisplay }}>{subtext}</StyledUSDValue>
69102
</TextContainer>
70103
</Container>
71104
);

web/src/layout/Header/navbar/Explore.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const StyledLink = styled(Link)<{ isActive: boolean; isMobileNavbar?: boolean }>
4545
${landscapeStyle(
4646
() => css`
4747
color: ${({ isActive, theme }) => (isActive ? theme.white : `${theme.white}BA`)};
48-
padding: 16px 10px;
48+
padding: 16px 8px;
4949
`
5050
)};
5151
`;

web/src/pages/Courts/CourtDetails/StakePanel/InputDisplay.tsx

-12
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ const StyledField = styled(NumberInputField)`
2626
const LabelArea = styled.div`
2727
display: flex;
2828
justify-content: space-between;
29-
30-
${landscapeStyle(
31-
() => css`
32-
width: 92%;
33-
`
34-
)}
3529
`;
3630

3731
const StyledLabel = styled.label`
@@ -45,12 +39,6 @@ const InputArea = styled.div`
4539
align-items: center;
4640
gap: 12px;
4741
width: 100%;
48-
49-
${landscapeStyle(
50-
() => css`
51-
width: 92%;
52-
`
53-
)}
5442
`;
5543

5644
const InputFieldAndButton = styled.div`

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

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import { Divider } from "components/Divider";
3131
const Container = styled.div`
3232
display: flex;
3333
flex-direction: column;
34-
max-width: 480px;
3534
background-color: ${({ theme }) => theme.lightBlue};
3635
box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);
3736
padding: 20px;

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

+1-9
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,20 @@ import Simulator from "./Simulator";
1313

1414
const Container = styled.div`
1515
position: relative;
16-
width: 100%;
1716
display: flex;
1817
flex-direction: column;
1918
gap: 28px;
2019
2120
${landscapeStyle(
2221
() => css`
23-
flex-direction: row;
24-
justify-content: space-between;
22+
flex-direction: column;
2523
`
2624
)};
2725
`;
2826

2927
const LeftArea = styled.div`
3028
display: flex;
3129
flex-direction: column;
32-
33-
${landscapeStyle(
34-
() => css`
35-
width: 50%;
36-
`
37-
)};
3830
`;
3931

4032
const TagArea = styled.div`

0 commit comments

Comments
 (0)