Skip to content

Commit 0034dfd

Browse files
committed
refactor: begin "new-transaction" route migration (WIP)
1 parent 5e24ad3 commit 0034dfd

File tree

5 files changed

+23
-52
lines changed

5 files changed

+23
-52
lines changed

web/src/global.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
* Default max screen width is 1250px
3131
* Default min screen width is 375px
3232
*/
33+
--spacing-fluid-0-132: clamp(0px, calc(0px + (132 - 0) * (100vw - 375px) / (1250 - 375)), 132px);
3334
--spacing-fluid-4-8: clamp(4px, calc(4px + (8 - 4) * (100vw - 375px) / (1250 - 375)), 8px);
3435
--spacing-fluid-6-8-300: clamp(6px, calc(6px + (8 - 6) * (100vw - 300px) / (1250 - 300)), 8px);
3536
--spacing-fluid-8-24: clamp(8px, calc(8px + (24 - 8) * (100vw - 375px) / (1250 - 375)), 24px);

web/src/pages/NewTransaction/HeroImage.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import React from "react";
2-
import { useTheme } from "styled-components";
2+
import { useTheme } from "src/hooks/useToggleThemeContext";
33
import { useWindowSize } from "react-use";
4-
import { BREAKPOINT_LANDSCAPE } from "styles/landscapeStyle";
54
import HeroLightMobile from "svgs/hero/hero-lightmode-mobile.svg";
65
import HeroDarkMobile from "svgs/hero/hero-darkmode-mobile.svg";
76
import HeroLightDesktop from "svgs/hero/hero-lightmode-desktop.svg";
87
import HeroDarkDesktop from "svgs/hero/hero-darkmode-desktop.svg";
8+
import { LG_BREAKPOINT } from "src/styles/breakpoints";
99

1010
const HeroImage = () => {
1111
const { width } = useWindowSize();
12-
const theme = useTheme();
13-
const themeIsLight = theme.name === "light";
14-
const screenIsBig = width > BREAKPOINT_LANDSCAPE;
12+
const [theme] = useTheme();
13+
const themeIsLight = theme === "light";
14+
const screenIsBig = width > LG_BREAKPOINT;
1515
return <div>{screenIsBig ? <HeroDesktop {...{ themeIsLight }} /> : <HeroMobile {...{ themeIsLight }} />}</div>;
1616
};
1717

web/src/pages/NewTransaction/Timeline.tsx

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,7 @@
11
import React from "react";
2-
import styled, { css } from "styled-components";
32
import { Steps } from "@kleros/ui-components-library";
4-
import { landscapeStyle } from "styles/landscapeStyle";
53
import { useLocation } from "react-router-dom";
64

7-
const StyledSteps = styled(Steps)`
8-
display: none;
9-
10-
${landscapeStyle(
11-
() => css`
12-
display: flex;
13-
position: absolute;
14-
left: 4%;
15-
height: 200px;
16-
`
17-
)}
18-
`;
19-
205
const items = [
216
{ title: "Escrow Details", subitems: ["Type of Escrow", "Title"] },
227
{ title: "Terms", subitems: ["Deliverable", "Payment", "Deadline"] },
@@ -41,7 +26,7 @@ const Timeline: React.FC = () => {
4126
0
4227
);
4328

44-
return <StyledSteps {...{ items, currentItemIndex }} />;
29+
return <Steps className="hidden lg:absolute lg:flex lg:left-[4%] lg:h-[200px]" {...{ items, currentItemIndex }} />;
4530
};
4631

4732
export default Timeline;

web/src/pages/NewTransaction/index.tsx

Lines changed: 15 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import React from "react";
22
import { Navigate, Route, Routes, useLocation } from "react-router-dom";
3-
import styled, { css } from "styled-components";
43
import { useWindowSize } from "react-use";
5-
import { BREAKPOINT_LANDSCAPE, MAX_WIDTH_LANDSCAPE, landscapeStyle } from "styles/landscapeStyle";
64
import Title from "./EscrowDetails/Title";
75
import TypeOfEscrow from "./EscrowDetails/TypeOfEscrow";
86
import HeroImage from "./HeroImage";
@@ -12,48 +10,34 @@ import Deliverable from "./Terms/Deliverable";
1210
import Notifications from "./Terms/Notifications";
1311
import Payment from "./Terms/Payment";
1412
import Timeline from "./Timeline";
15-
import { responsiveSize } from "styles/responsiveSize";
1613
import { useAccount } from "wagmi";
1714
import ConnectWallet from "components/ConnectWallet";
18-
import { ConnectWalletContainer } from "../MyTransactions";
1915
import { DEFAULT_CHAIN } from "consts/chains";
2016
import { EnsureAuth } from "components/EnsureAuth";
21-
22-
const Container = styled.div`
23-
width: 100%;
24-
background-color: ${({ theme }) => theme.lightBackground};
25-
padding: 24px 16px 40px;
26-
max-width: ${MAX_WIDTH_LANDSCAPE};
27-
margin: 0 auto;
28-
29-
${landscapeStyle(
30-
() => css`
31-
padding: 32px ${responsiveSize(0, 132)} 60px;
32-
`
33-
)}
34-
`;
35-
36-
const MiddleContentContainer = styled.div`
37-
display: flex;
38-
justify-content: center;
39-
`;
17+
import clsx from "clsx";
18+
import { LG_BREAKPOINT } from "src/styles/breakpoints";
4019

4120
const NewTransaction: React.FC = () => {
4221
const location = useLocation();
4322
const { width } = useWindowSize();
4423
const { isConnected, chain } = useAccount();
4524
const isPreviewPage = location.pathname.includes("/preview");
46-
const isMobileView = width <= BREAKPOINT_LANDSCAPE;
25+
const isMobileView = width <= LG_BREAKPOINT;
4726
const isOnSupportedChain = chain?.id === DEFAULT_CHAIN;
4827

4928
return (
5029
<>
5130
{!isPreviewPage || isMobileView ? <HeroImage /> : null}
52-
<Container>
31+
<div
32+
className={clsx(
33+
"w-full max-w-landscape mx-auto bg-klerosUIComponentsLightBackground",
34+
"px-4 pt-6 pb-10 lg:px-fluid-0-132 lg:pt-8 lg:pb-[60px]"
35+
)}
36+
>
5337
{isConnected && isOnSupportedChain && !isPreviewPage ? <Timeline /> : null}
5438
{isConnected && isOnSupportedChain ? (
5539
<EnsureAuth message={"Sign a message to verify yourself."} buttonText="Verify">
56-
<MiddleContentContainer>
40+
<div className="flex justify-center">
5741
<Routes>
5842
<Route index element={<Navigate to="escrow-type" replace />} />
5943
<Route path="/escrow-type/*" element={<TypeOfEscrow />} />
@@ -64,16 +48,16 @@ const NewTransaction: React.FC = () => {
6448
<Route path="/notifications/*" element={<Notifications />} />
6549
<Route path="/preview/*" element={<Preview />} />
6650
</Routes>
67-
</MiddleContentContainer>
51+
</div>
6852
</EnsureAuth>
6953
) : (
70-
<ConnectWalletContainer>
54+
<div className="flex flex-col items-center text-center text-klerosUIComponentsPrimaryText">
7155
To create a new escrow transaction, connect first and switch to the supported chain
72-
<hr />
56+
<hr className="my-2" />
7357
<ConnectWallet />
74-
</ConnectWalletContainer>
58+
</div>
7559
)}
76-
</Container>
60+
</div>
7761
</>
7862
);
7963
};

web/src/styles/breakpoints.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const LG_BREAKPOINT = 900;

0 commit comments

Comments
 (0)