Skip to content

Commit a5f70c0

Browse files
committed
fix(web): modularization of components, mobilecard, desktopcard, style changes
1 parent aec9451 commit a5f70c0

File tree

15 files changed

+356
-182
lines changed

15 files changed

+356
-182
lines changed

web/src/components/Popup/MiniGuides/Template.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ const Close = styled.label`
7676
justify-content: flex-end;
7777
cursor: pointer;
7878
79+
&:hover {
80+
text-decoration: underline;
81+
}
82+
7983
color: ${({ theme }) => theme.primaryBlue};
8084
8185
${landscapeStyle(

web/src/pages/Dashboard/Courts/CourtCard.tsx

Lines changed: 0 additions & 97 deletions
This file was deleted.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import React from "react";
2+
import styled, { css } from "styled-components";
3+
import { landscapeStyle } from "styles/landscapeStyle";
4+
import { Breadcrumb } from "@kleros/ui-components-library";
5+
6+
const CourtName = styled.div`
7+
small {
8+
height: 100%;
9+
}
10+
11+
${landscapeStyle(() => css``)}
12+
`;
13+
14+
const StyledBreadcrumb = styled(Breadcrumb)`
15+
display: flex;
16+
align-items: center;
17+
height: 100%;
18+
`;
19+
20+
interface ICourtBranch {
21+
name: string;
22+
}
23+
24+
const CourtBranch: React.FC<ICourtBranch> = ({ name }) => {
25+
return (
26+
<CourtName>
27+
<StyledBreadcrumb items={[{ text: name, value: 0 }]} />
28+
</CourtName>
29+
);
30+
};
31+
export default CourtBranch;
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import React from "react";
2+
import styled, { css } from "styled-components";
3+
import { landscapeStyle } from "styles/landscapeStyle";
4+
import { Card as _Card } from "@kleros/ui-components-library";
5+
import CourtBranch from "./CourtBranch";
6+
import Stake from "./Stake";
7+
import LockedStake from "./LockedStake";
8+
9+
const Container = styled(_Card)`
10+
display: none;
11+
12+
flex-direction: row;
13+
align-items: center;
14+
justify-content: space-between;
15+
height: auto;
16+
width: 100%;
17+
padding: 21.5px 32px 21.5px 27px;
18+
border-left: 5px solid ${({ theme }) => theme.secondaryPurple};
19+
flex-wrap: wrap;
20+
gap: 20px;
21+
22+
${({ theme }) => (theme.name === "light" ? `box-shadow: 0px 2px 3px 0px ${theme.stroke};` : "")}
23+
24+
${landscapeStyle(
25+
() =>
26+
css`
27+
display: flex;
28+
`
29+
)}
30+
`;
31+
32+
const StakesContainer = styled.div`
33+
display: flex;
34+
flex-direction: row;
35+
align-items: center;
36+
justify-content: space-between;
37+
width: 220px;
38+
gap: 32px;
39+
`;
40+
41+
interface IDesktopCard {
42+
name: string;
43+
stake: bigint;
44+
lockedStake: bigint;
45+
}
46+
47+
const DesktopCard: React.FC<IDesktopCard> = ({ name, stake, lockedStake }) => {
48+
return (
49+
<Container>
50+
<CourtBranch name={name} />
51+
<StakesContainer>
52+
<Stake stake={stake} />
53+
<LockedStake lockedStake={lockedStake} />
54+
</StakesContainer>
55+
</Container>
56+
);
57+
};
58+
59+
export default DesktopCard;
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import React from "react";
2+
import styled, { css } from "styled-components";
3+
import { landscapeStyle } from "styles/landscapeStyle";
4+
import { formatUnits } from "viem";
5+
6+
const StyledLockedStakeLabel = styled.label`
7+
display: flex;
8+
justify-content: flex-end;
9+
color: ${({ theme }) => theme.primaryText};
10+
11+
${landscapeStyle(
12+
() => css`
13+
min-width: 107px;
14+
`
15+
)}
16+
`;
17+
18+
interface ILockedStake {
19+
lockedStake: bigint;
20+
}
21+
22+
const LockedStake: React.FC<ILockedStake> = ({ lockedStake }) => {
23+
const formattedLockedStake = formatUnits(lockedStake, 18);
24+
25+
return <StyledLockedStakeLabel>{`${formattedLockedStake} PNK`}</StyledLockedStakeLabel>;
26+
};
27+
export default LockedStake;
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import React from "react";
2+
import styled, { css } from "styled-components";
3+
import { landscapeStyle } from "styles/landscapeStyle";
4+
import { Card as _Card } from "@kleros/ui-components-library";
5+
import CourtBranch from "./CourtBranch";
6+
import Stake from "./Stake";
7+
import LockedStake from "./LockedStake";
8+
9+
const Container = styled(_Card)`
10+
display: flex;
11+
flex-direction: column;
12+
align-items: center;
13+
justify-content: space-between;
14+
height: auto;
15+
width: 100%;
16+
padding: 21.5px 32px 21.5px 27px;
17+
border-left: 5px solid ${({ theme }) => theme.secondaryPurple};
18+
flex-wrap: wrap;
19+
gap: 20px;
20+
21+
${({ theme }) => (theme.name === "light" ? `box-shadow: 0px 2px 3px 0px ${theme.stroke};` : "")}
22+
23+
${landscapeStyle(
24+
() =>
25+
css`
26+
display: none;
27+
`
28+
)}
29+
`;
30+
31+
const StakesContainer = styled.div`
32+
display: flex;
33+
flex-direction: row;
34+
align-items: center;
35+
justify-content: space-between;
36+
width: 220px;
37+
gap: 32px;
38+
`;
39+
40+
interface IMobileCard {
41+
name: string;
42+
stake: bigint;
43+
lockedStake: bigint;
44+
}
45+
46+
const MobileCard: React.FC<IMobileCard> = ({ name, stake, lockedStake }) => {
47+
return (
48+
<Container>
49+
<CourtBranch name={name} />
50+
<StakesContainer>
51+
<Stake stake={stake} />
52+
<LockedStake lockedStake={lockedStake} />
53+
</StakesContainer>
54+
</Container>
55+
);
56+
};
57+
58+
export default MobileCard;
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import React from "react";
2+
import styled, { css } from "styled-components";
3+
import { landscapeStyle } from "styles/landscapeStyle";
4+
import { formatUnits } from "viem";
5+
6+
const StyledStakeLabel = styled.label`
7+
display: flex;
8+
font-weight: 600;
9+
color: ${({ theme }) => theme.primaryText};
10+
justify-content: flex-end;
11+
12+
${landscapeStyle(
13+
() => css`
14+
width: 140px;
15+
`
16+
)}
17+
`;
18+
19+
interface IStake {
20+
stake: bigint;
21+
}
22+
23+
const Stake: React.FC<IStake> = ({ stake }) => {
24+
const formattedStake = formatUnits(stake, 18);
25+
26+
return <StyledStakeLabel>{`${formattedStake} PNK`}</StyledStakeLabel>;
27+
};
28+
export default Stake;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import React from "react";
2+
import DesktopCard from "./DesktopCard";
3+
import MobileCard from "./MobileCard";
4+
5+
interface ICourtCard {
6+
name: string;
7+
stake: bigint;
8+
lockedStake: bigint;
9+
}
10+
11+
const CourtCard: React.FC<ICourtCard> = ({ name, stake, lockedStake }) => {
12+
const allProps = { name, stake, lockedStake };
13+
14+
return (
15+
<>
16+
<DesktopCard {...allProps} />
17+
<MobileCard {...allProps} />
18+
</>
19+
);
20+
};
21+
22+
export default CourtCard;

0 commit comments

Comments
 (0)