Skip to content

Commit 8ce952c

Browse files
committed
chore: ui-library-migration
1 parent 38a1d7c commit 8ce952c

File tree

82 files changed

+3255
-487
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+3255
-487
lines changed

web/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@
6666
},
6767
"dependencies": {
6868
"@cyntler/react-doc-viewer": "^1.16.3",
69+
"@internationalized/date": "^3.7.0",
6970
"@kleros/kleros-app": "^2.0.2",
70-
"@kleros/ui-components-library": "^2.19.0",
71+
"@kleros/ui-components-library": "3.0.0-rc1",
7172
"@reown/appkit": "^1.6.6",
7273
"@reown/appkit-adapter-wagmi": "^1.6.6",
7374
"@sentry/react": "^7.93.0",

web/src/app.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Navigate, Route } from "react-router-dom";
33
import { SentryRoutes } from "./utils/sentry";
44
import "react-loading-skeleton/dist/skeleton.css";
55
import "react-toastify/dist/ReactToastify.css";
6+
import "@kleros/ui-components-library/dist/ui-components-library.css";
67
import Web3Provider from "context/Web3Provider";
78
import IsListProvider from "context/IsListProvider";
89
import QueryClientProvider from "context/QueryClientProvider";
@@ -15,6 +16,7 @@ import { NewTransactionProvider } from "./context/NewTransactionContext";
1516
import AttachmentDisplay from "./pages/AttachmentDisplay";
1617
import AtlasProvider from "./context/AtlasProvider";
1718
import Settings from "./pages/Settings";
19+
import { StyledH1 } from "./components/StyledTags";
1820

1921
const App: React.FC = () => {
2022
return (
@@ -32,7 +34,7 @@ const App: React.FC = () => {
3234
<Route path="transactions/*" element={<MyTransactions />} />
3335
<Route path="attachment/*" element={<AttachmentDisplay />} />
3436
<Route path="settings/*" element={<Settings />} />
35-
<Route path="*" element={<h1>404 not found</h1>} />
37+
<Route path="*" element={<StyledH1>404 not found</StyledH1>} />
3638
</Route>
3739
</SentryRoutes>
3840
</NewTransactionProvider>

web/src/components/ConnectWallet/AccountDisplay.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { getChain } from "consts/chains";
1010
import { shortenAddress } from "utils/shortenAddress";
1111

1212
import { landscapeStyle } from "styles/landscapeStyle";
13+
import { StyledLabel } from "../StyledTags";
1314

1415
const Container = styled.div`
1516
display: flex;
@@ -153,13 +154,13 @@ export const AddressOrName: React.FC<IAddressOrName> = ({ address: propAddress }
153154
chainId: 1,
154155
});
155156

156-
return <label>{data ?? (isAddress(address!) ? shortenAddress(address) : address)}</label>;
157+
return <StyledLabel>{data ?? (isAddress(address!) ? shortenAddress(address) : address)}</StyledLabel>;
157158
};
158159

159160
export const ChainDisplay: React.FC = () => {
160161
const chainId = useChainId();
161162
const chain = getChain(chainId);
162-
return <label>{chain?.name}</label>;
163+
return <StyledLabel>{chain?.name}</StyledLabel>;
163164
};
164165

165166
const AccountDisplay: React.FC = () => {

web/src/components/ConnectWallet/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ export const SwitchChainButton: React.FC<{ className?: string }> = ({ className
2222
<Button
2323
{...{ className }}
2424
isLoading={isPending}
25-
disabled={isPending}
25+
isDisabled={isPending}
2626
text={`Switch to ${SUPPORTED_CHAINS[DEFAULT_CHAIN].name}`}
27-
onClick={handleSwitch}
27+
onPress={handleSwitch}
2828
/>
2929
);
3030
};
@@ -35,10 +35,10 @@ const ConnectButton: React.FC<{ className?: string }> = ({ className }) => {
3535
return (
3636
<Button
3737
{...{ className }}
38-
disabled={isOpen}
38+
isDisabled={isOpen}
3939
small
4040
text={"Connect"}
41-
onClick={async () => open({ view: "Connect" })}
41+
onPress={async () => open({ view: "Connect" })}
4242
/>
4343
);
4444
};

web/src/components/EnsureAuth.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { Button } from "@kleros/ui-components-library";
77
import styled from "styled-components";
88
import { useAtlasProvider } from "@kleros/kleros-app";
99
import { errorToast, infoToast, successToast } from "utils/wrapWithToast";
10+
import { StyledP } from "./StyledTags";
1011

1112
const Container = styled.div`
1213
display: flex;
@@ -16,7 +17,7 @@ const Container = styled.div`
1617
align-items: center;
1718
`;
1819

19-
const StyledInfo = styled.p`
20+
const StyledInfo = styled(StyledP)`
2021
margin: 0;
2122
padding: 0;
2223
`;
@@ -49,8 +50,8 @@ export const EnsureAuth: React.FC<IEnsureAuth> = ({ children, message, buttonTex
4950
{message ? <StyledInfo>{message}</StyledInfo> : null}
5051
<Button
5152
text={buttonText ?? "Sign In"}
52-
onClick={handleClick}
53-
disabled={isSigningIn || !address}
53+
onPress={handleClick}
54+
isDisabled={isSigningIn || !address}
5455
isLoading={isSigningIn}
5556
{...{ className }}
5657
/>

web/src/components/LightButton.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { landscapeStyle } from "styles/landscapeStyle";
44
import { hoverShortTransitionTiming } from "styles/commonStyles";
55

66
import { Button } from "@kleros/ui-components-library";
7+
import { type ButtonProps } from "@kleros/ui-components-library/dist/lib/button";
78

89
const StyledButton = styled(Button)<{ isMobileNavbar?: boolean }>`
910
${hoverShortTransitionTiming}
@@ -38,14 +39,14 @@ const StyledButton = styled(Button)<{ isMobileNavbar?: boolean }>`
3839
interface ILightButton {
3940
text: string;
4041
Icon?: React.FC<React.SVGAttributes<SVGElement>>;
41-
onClick?: React.MouseEventHandler<HTMLButtonElement>;
42+
onClick?: ButtonProps["onPress"];
4243
disabled?: boolean;
4344
className?: string;
4445
isMobileNavbar?: boolean;
4546
}
4647

4748
const LightButton: React.FC<ILightButton> = ({ text, Icon, onClick, disabled, className, isMobileNavbar }) => (
48-
<StyledButton variant="primary" small {...{ text, Icon, onClick, disabled, className, isMobileNavbar }} />
49+
<StyledButton variant="primary" small {...{ text, Icon, onPress: onClick, disabled, className, isMobileNavbar }} />
4950
);
5051

5152
export default LightButton;

web/src/components/OpenModalRaiseDisputeButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const OpenModalRaiseDisputeButton: React.FC<IOpenModalRaiseDisputeButton> = ({ a
1212

1313
return (
1414
<>
15-
<Button variant="secondary" text={"Raise a dispute"} onClick={toggleModal} />
15+
<Button variant="secondary" text={"Raise a dispute"} onPress={toggleModal} />
1616
{isModalOpen ? <RaiseDisputeModal {...{ toggleModal, arbitrationCost }} /> : null}
1717
</>
1818
);

web/src/components/PreviewCard/Header.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { mapStatusToEnum } from "utils/mapStatusToEnum";
88
import { StyledSkeleton } from "../StyledSkeleton";
99
import StatusBanner from "../TransactionCard/StatusBanner";
1010
import EtherscanIcon from "svgs/icons/etherscan.svg";
11+
import { StyledH1, StyledLabel as Label, StyledA } from "../StyledTags";
1112

1213
const Container = styled.div`
1314
display: flex;
@@ -17,11 +18,11 @@ const Container = styled.div`
1718
gap: 12px;
1819
`;
1920

20-
const StyledLabel = styled.label`
21+
const StyledLabel = styled(Label)`
2122
color: ${({ theme }) => theme.secondaryPurple};
2223
`;
2324

24-
const StyledHeader = styled.h1`
25+
const StyledHeader = styled(StyledH1)`
2526
margin: 0;
2627
flex-wrap: wrap;
2728
word-break: break-word;
@@ -75,9 +76,9 @@ const Header: React.FC<IHeader> = ({ escrowType, escrowTitle, id, status, transa
7576
</LeftContent>
7677
<RightContent>
7778
{transactionHash ? (
78-
<a href={etherscanUrl} target="_blank" rel="noreferrer">
79+
<StyledA href={etherscanUrl} target="_blank" rel="noreferrer">
7980
<StyledEtherscanIcon />
80-
</a>
81+
</StyledA>
8182
) : null}
8283
<StatusBanner status={currentStatusEnum} isPreview={true} />
8384
</RightContent>

web/src/components/PreviewCard/Terms/Header.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import React from "react";
22
import styled from "styled-components";
3+
import { StyledH3 } from "components/StyledTags";
34

4-
const StyledHeader = styled.h3`
5+
const StyledHeader = styled(StyledH3)`
56
margin-bottom: 0;
67
`;
78

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import styled from "styled-components";
2+
3+
export const StyledH1 = styled.h1`
4+
margin: 0 0 16px 0;
5+
font-weight: 600;
6+
font-size: 24px;
7+
line-height: 32px;
8+
color: ${({ theme }) => theme.primaryText};
9+
`;
10+
11+
export const StyledH2 = styled.h2`
12+
margin: 0 0 16px 0;
13+
font-weight: 400;
14+
font-size: 24px;
15+
line-height: 32px;
16+
color: ${({ theme }) => theme.primaryText};
17+
`;
18+
19+
export const StyledH3 = styled.h3`
20+
margin: 0 0 16px 0;
21+
font-weight: 600;
22+
font-size: 16px;
23+
line-height: 24px;
24+
color: ${({ theme }) => theme.primaryText};
25+
`;
26+
27+
export const StyledP = styled.p`
28+
font-weight: 400;
29+
font-size: 16px;
30+
line-height: 24px;
31+
color: ${({ theme }) => theme.primaryText};
32+
`;
33+
34+
export const StyledSmall = styled.small`
35+
font-weight: 600;
36+
font-size: 14px;
37+
line-height: 18px;
38+
color: ${({ theme }) => theme.primaryText};
39+
`;
40+
41+
export const StyledLabel = styled.label`
42+
font-weight: 400;
43+
font-size: 14px;
44+
line-height: 18px;
45+
color: ${({ theme }) => theme.secondaryText};
46+
`;
47+
48+
export const StyledA = styled.a`
49+
font-weight: 400;
50+
font-size: 14px;
51+
text-decoration: none;
52+
color: ${({ theme }) => theme.primaryBlue};
53+
`;
54+
55+
export const StyledHr = styled.hr`
56+
opacity: 1;
57+
border: 1px solid ${({ theme }) => theme.stroke};
58+
`;

0 commit comments

Comments
 (0)