From 82cfcc9b156cee7ecba7b99aa24205d12ed536d4 Mon Sep 17 00:00:00 2001 From: Stephanie Nwankwo <63151237+GoSTEAN@users.noreply.github.com> Date: Thu, 19 Dec 2024 13:51:27 +0000 Subject: [PATCH 1/3] Add new page add_deposit --- frontend/src/App.jsx | 2 + .../TokenSelector/TokenSelector.css | 536 ++++++++++++++++++ .../TokenSelector/TokenSelector.jsx | 38 ++ .../pages/spotnet/dashboard/add_deposit.css | 506 +++++++++++++++++ .../pages/spotnet/dashboard/add_deposit.jsx | 55 ++ 5 files changed, 1137 insertions(+) create mode 100644 frontend/src/components/TokenSelector/TokenSelector.css create mode 100644 frontend/src/components/TokenSelector/TokenSelector.jsx create mode 100644 frontend/src/pages/spotnet/dashboard/add_deposit.css create mode 100644 frontend/src/pages/spotnet/dashboard/add_deposit.jsx diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 07c236a6..d36243ab 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -22,6 +22,7 @@ import { TELEGRAM_BOT_LINK } from 'utils/constants'; import { useCheckMobile } from 'hooks/useCheckMobile'; import { notifyError } from 'utils/notification'; import PositionHistory from 'pages/spotnet/position_history/PositionHistory'; +import Add_Deposit from 'pages/spotnet/dashboard/add_deposit'; function App() { @@ -104,6 +105,7 @@ function App() { element={walletId ? : } /> } /> + } /> } /> } /> } /> diff --git a/frontend/src/components/TokenSelector/TokenSelector.css b/frontend/src/components/TokenSelector/TokenSelector.css new file mode 100644 index 00000000..2dedc3f3 --- /dev/null +++ b/frontend/src/components/TokenSelector/TokenSelector.css @@ -0,0 +1,536 @@ +.form-content-wrapper { + background: url('/public/background.png') no-repeat; + background-size: cover; + background-position: center 50%; + display: flex; + flex-direction: column; + gap: 30px; + justify-content: flex-start; + align-items: center; + padding-top: 1rem; + padding-bottom: 1rem; + font-family: var(--font-family); + height: 100vh; +} + +.form-container { + display: flex; + justify-content: center; + flex-direction: column; + gap: 10px; + padding-bottom: 60px; +} + +.form-title h1 { + text-align: center; + font-weight: normal; + font-size: 20px; + margin-bottom: 10px; +} + +.token-card { + width: 148px; + height: 64px; +} + +.token-card label { + border-radius: 100px; + padding: 2px 24px; + display: flex; + justify-content: center; + align-items: center; + background-color: var(--dark-purple); + cursor: pointer; + height: 100%; +} + +.token-container { + border-radius: 100px; + background: var(--light-purple); + transition: background 1.3s ease; + padding: 1px; + height: 100%; +} + +.token-container:has(input[type='radio']:checked) { + background: var(--button-gradient); +} + +.token-icon { + display: flex; + align-items: center; + justify-content: center; + padding: 5px; + border-radius: 2000px; + background-color: hsla(261, 49%, 15%, 1); +} + +.token-label { + display: flex; + flex-direction: column; + gap: 5px; + margin-top: 60px; +} + +.token-label input { + background-color: transparent; + border: 1px solid var(--light-purple); + border-radius: 50px; + padding: 20px 30px; + color: var(--gray); +} + +.form-container > * { + color: var(--primary); +} + +.form-container label { + color: var(--gray); + font-size: 1rem; +} + +.token-select { + margin: 8px 0 8px 0; +} + +.token-amount { + margin: 20px 0 12px 0; +} + +.token-card h5 { + margin-top: 9px; + font-size: 16px; + font-size: 16px; + color: var(--primary); + display: flex; + align-items: center; + justify-content: center; + gap: 6px; +} + +.token-card svg { + width: 20px; + height: 20px; + width: 20px; + height: 20px; +} + +.form-token { + display: flex; + justify-content: center; + align-items: center; + gap: 80px; + margin-bottom: 20px; +} + +.multiplier-card { + display: flex; + align-items: center; + justify-content: space-around; + position: relative; + gap: 10px; + font-family: var(--font-family); +} + +.recommended { + position: absolute; + height: 15px; +} + +.recommended p { + background-color: var(--brand); + width: 120px; + height: 15px; + text-align: center; + font-weight: bold; + font-size: 11px; + border-radius: 5px 5px 0 0; + display: flex; + align-items: center; + color: black; + font-family: var(--text-font); + justify-content: center; +} + +.recommended-item { + display: flex; + align-items: flex-end !important; + font-size: 20px; +} + +.multiplier-item label { + border: 1px solid var(--brand); + width: 120px; + height: 50px; + border-radius: 8px; + font-size: 24px; + display: flex; + justify-content: center; +} + +.multiplier-item:not(.recommended-item) label { + align-items: center; + font-size: 21px; +} + +input[type='radio'] { + display: none; + padding: 2px; + border: 1px solid #ccc; + border-radius: 4px; + width: 100%; + box-sizing: border-box; +} + +.multiplier-item input[type='radio']:checked + label { + border-color: var(--brand); + box-shadow: 0 4px 20px var(--brand); +} + +input[type='number']::-webkit-outer-spin-button, +input[type='number']::-webkit-inner-spin-button { + -webkit-appearance: none; + margin: 0; +} + +input[type='number'] { + appearance: textfield; + -moz-appearance: textfield; + -webkit-appearance: none; + color: var(--primary); +} + +.error-message { + padding: 10px; + border-radius: 5px; + background-color: red; + font-size: 15px; + color: black; + margin-bottom: 5px; +} + +input[type='number'].error { + border-color: red; + background-color: #ffe6e6; + color: var(--black); +} + +.form-button { + width: 642px; + border: solid 5px transparent; + height: 60px; + border-radius: inherit; + font-size: 20px; + font-family: var(--text-font); + font-weight: 700; + color: var(--primary); + background-color: hsla(265, 65%, 8%, 1); +} + +.form-button-container { + margin-top: 20px; + padding: 1px; +} + +.balance-card { + max-width: 100%; + margin-top: 20px; +} + +.form-alert { + display: flex; + align-items: center; +} + +.form-alert-hex { + margin-left: auto; +} + +.balance-container { + display: flex; + justify-content: space-between; + max-width: 100%; + gap: 16px; +} + +.balance-item { + display: flex; + flex-direction: column; + width: 198px; + height: 101px; + align-items: center; + border-radius: 900px; + border: 1px solid var(--light-purple); + justify-content: center; + background-color: var(--dark-purple); + padding: 16px 30px; +} + +.balance-item label:nth-child(1) { + font-size: 14px; + color: var(--secondary); + display: flex; + gap: 4px; +} + +.balance-item label:nth-child(2) { + font-size: 24px; + color: var(--secondary); + line-height: 32.68px; +} + +.balance-title { + display: flex; + align-items: center; + justify-content: center; +} + +.balance-title span { + font-size: 14px; +} + +.balance-title .balance-icon-wrapper { + background-color: #201338; + border-radius: 12px; + display: block; + width: 24px; + height: 24px; + display: flex; + align-items: center; + justify-content: center; + margin-right: 10px; + margin-bottom: 0; +} + +.balance-title svg { + height: 18px; + width: 18px; + height: 18px; + width: 18px; +} + +.balance-title.blend svg { + filter: grayscale(1); +} + +/* Responsiveness */ +/* Mobile */ +@media (max-width: 768px) { + .form-content-wrapper { + gap: 0; + } + + .form-container { + padding: 0; + margin-left: 0; + margin-right: 0; + width: 100%; + padding: 1rem; + } + + .form-container > form { + padding: 0 1rem; + } + + .form-button { + font-size: 16px; + } + + .form-token { + max-width: 100%; + overflow-x: scroll; + gap: 40px; + scrollbar-width: none; + } + + .form-container label { + font-size: 12px; + } + + .balance-container { + flex-direction: row; + justify-content: flex-start; + gap: 1rem; + align-items: center; + margin-bottom: 0; + overflow-x: auto; + scroll-snap-type: x mandatory; + gap: 20px; + max-width: 100%; + scrollbar-width: none; + -ms-overflow-style: none; + } + + .balance-item { + height: fit-content; + padding: 16px 24px; + display: flex; + flex-direction: column; + align-items: center; + margin-right: 0; + border-radius: 16px; + } + + .balance-item:first-child { + margin-left: 20px; + } + + .balance-item:last-child { + margin-right: 20px; + } + + .balance-item .balance-title { + font-size: 1rem; + display: flex; + align-items: center; + } + + .balance-item .title-container + label:nth-of-type(1) { + font-size: 20px; + font-weight: 600; + } + + .title-container { + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; + width: max-content; + } + + .multiplier-card { + grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); + display: grid; + } + + .balance-item label:nth-child(2) { + color: var(--secondary); + font-size: 14px; + } + + .form-title h1 { + text-align: center; + font-weight: normal; + font-size: 1rem; + margin-bottom: 20px; + } + + .token-icon { + margin-right: 5px; + position: relative; + z-index: 1; + } + + .token-card { + width: auto; + height: auto; + } + + .token-card h5 { + margin: 0; + font-size: 14px; + gap: 0; + } + + .token-card svg { + width: 15px; + height: 15px; + } + + .token-label input { + border-radius: 16px; + font-size: 14px; + } + + .token-card label { + border-radius: 12px; + max-width: max-content; + padding: 4px 8px; + } + + .token-container { + border-radius: 12px; + max-width: fit-content; + position: relative; + } + + .pagination { + display: flex; + gap: 8px; + margin-top: 25px; + justify-content: center; + } + + .dot { + width: 8px; + height: 8px; + border-radius: 50%; + background-color: rgba(255, 255, 255, 0.3); + transition: background-color 0.3s ease; + } + + .dot.active { + background-color: var(--light-blue); + } + + .token-label { + margin-top: 0; + } + .token-amount { + margin: 25px 0 12px 0; + } +} + +@media (max-width: 480px) { + .form-token { + max-width: 100%; + overflow-x: scroll; + gap: 16px; + scrollbar-width: none; + } +} + +@media (max-width: 375px) { + .token-amount { + margin: 20px 0 12px 0; + } +} + +/* Tablet devices */ +@media screen and (min-width: 600px) and (max-width: 900px) { +} + +/* Large screens */ +@media (min-width: 1800px) { + .form-card { + width: 400px; + } + + .form-token label, + .multiplier-card label { + width: auto; + height: 60px; + } + + input[type='number'] { + height: 60px; + } + + .recommended p { + width: 150px; + height: 22px; + font-size: 15px; + } +} + +.form-health-factor{ + display: flex; + flex-direction: row; + align-items: end; + justify-self: flex-end; + width: fit-content; + margin: 2px; + color: gray; + align-self: flex-end; + gap: 5px; +} \ No newline at end of file diff --git a/frontend/src/components/TokenSelector/TokenSelector.jsx b/frontend/src/components/TokenSelector/TokenSelector.jsx new file mode 100644 index 00000000..f6e66774 --- /dev/null +++ b/frontend/src/components/TokenSelector/TokenSelector.jsx @@ -0,0 +1,38 @@ +import React from 'react'; +import { ReactComponent as ETH } from 'assets/icons/ethereum.svg'; +import { ReactComponent as USDC } from 'assets/icons/borrow_usdc.svg'; +import { ReactComponent as STRK } from 'assets/icons/strk.svg'; +import './TokenSelector.css' +const Tokens = [ + { id: 'ethOption', component: , label: 'ETH' }, + { id: 'usdcOption', component: , label: 'USDC' }, + { id: 'strkOption', component: , label: 'STRK' }, +]; + +const TokenSelectorDeposit = ({ selectedToken, setSelectedToken }) => { + return ( +
+ {Tokens.map((token) => ( +
+
+ setSelectedToken(token?.label)} + /> + +
+
+ ))} +
+ ); +}; + +export default TokenSelectorDeposit; diff --git a/frontend/src/pages/spotnet/dashboard/add_deposit.css b/frontend/src/pages/spotnet/dashboard/add_deposit.css new file mode 100644 index 00000000..7e4a0833 --- /dev/null +++ b/frontend/src/pages/spotnet/dashboard/add_deposit.css @@ -0,0 +1,506 @@ +body { + font-family: + 'Rethink Sans', + -apple-system, + Roboto, + Helvetica, + sans-serif; + } + .deposit-wrapper { + background: url('../../../../public/background.png') no-repeat; + background-size: cover; + background-position: center 39%; + min-height: 100vh; + display: flex; + justify-content: center; + align-items: flex-start; + padding: 1rem; + padding-top: 24px; + transition: all 0.2s ease-in-out; + padding-bottom:4rem; + } + + .deposit-container { + display: flex; + flex-direction: column; + justify-content: center; + gap: 24px; + margin-left: 200px; + transition: all 0.3s ease-in-out + } + + .deposit-title1 { + font-size: 24px; + font-weight: 600; + color: #ffffff; + text-align: center; + } + + .main-container-deposit { + width: 642px; + gap: 2px; + padding-top: 24px; + border-radius: 8px; + color: var(--primary); + text-align: center; + display: flex; + justify-content: center; + + flex-direction: column; + align-items: center; + } + + .top-cards-deposit { + display: flex; + gap: 1.5rem; + width: 642px; + height: 101px; + } + + .deposit-title2 { + font-size: 14px; + font-weight: 400; + color: var(--primary); + text-align: center; + margin-top: 2rem; + } + + .card-header { + color: var(--stormy-gray); + } + + .card-icon { + margin-right: 5px; + width: 16px; + height: 16px; + } + + .main-card-deposit { + padding: 1.5rem; + height: auto; + display: flex; + flex-direction: column; + gap: 38px; + border:none; + } + + .token-select-dep{ + color: #83919F; + padding:15px 8px; + margin-left:2rem; + } + .deposit-token{ + border: none; + border-radius:8px; + background-color: white; + } + + + .amount-stack-card { + background: var(--footer-divider-bg); + border: var(--midnight-purple-border); + padding: 2rem; + border-radius: 8px; + width: 100%; + display: flex; + align-items: center; + justify-content: space-between; + } + + .amount-stack-card-title-container { + text-align: center; + display: flex; + flex-direction: column; + align-items: center; + } + + .deposit-input-container { + padding: 8px 0; + } + + .deposit-input-title { + font-size: 16px; + color: var(--stormy-gray); + margin-bottom: 5px; + } + + .deposit-input{ + width: 100%; + height: 60px; + background: transparent; + border: var(--midnight-purple-border); + border-radius: 8px; + border-radius: 8px; + padding: 16px; + color: var(--primary); + font-size: 16px; + } + + /* main card footer */ + .divider { + width: 100%; + height: 1.5px; + background: var(--footer-divider-bg); + margin: 1rem 0; + } + + .settings-fee-container { + width: 100%; + display: flex; + align-items: center; + justify-content: space-between; + padding: 6px 0px 12px 0px ; + } + + .fee-title { + color: var(--stormy-gray); + font-size: 12px; + font-weight: 400; + } + + .setting-circle { + width: 32px; + height: 32px; + background-color: var(--footer-divider-bg); + border-radius: 50%; + display: inline-block; + position: relative; + cursor: pointer; + } + + .setting-icon { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + width: 16px; + height: 16px; + } + + .deposit-button { + position: relative; + display: inline-block; + font-weight: 600; + /* width: 642px; */ + width: 100%; + height: 60px; + background: none; + color: var(--primary); + font-size: 16px; + cursor: pointer; + border: none; + padding: 16px 24px 16px 24px; + z-index: 1; + overflow: hidden; + } + + .deposit-button::before { + content: ''; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + border-radius: 8px; + border-radius: 8px; + padding: 2px; + background: var(--blue-pink-gradient); + -webkit-mask: + linear-gradient(#fff 0 0) content-box, + linear-gradient(#fff 0 0); + mask: + linear-gradient(#fff 0 0) content-box, + linear-gradient(#fff 0 0); + -webkit-mask-composite: destination-out; + mask-composite: exclude; + z-index: -1; + } + + .mobile-screen-btns { + display: none; + } + + + @media (max-width: 1024px) { + .deposit-container { + width: 642px; + margin-left: 0; + } + + .main-card { + margin: 0 auto; + width: 100px; + width: 100%; + gap: 20px; + } + + .deposit-button { + font-size: 16px; + padding: 16px 24px; + margin-left: 12px; + margin-right: 11px; + align-self: center; + } + } + + @media (max-width: 768px) { + .deposit-container { + margin-left: 0px; + } + } + + @media (max-width: 680px){ + .deposit-container { + + /* margin-top: -120px; + margin-left: 0px; */ + } + + /* .deposital-title { + font-size: 24px; + } */ + + .deposital-title { + margin: 0; + } + + .top-cards-deposit{ + width: 500px; + margin: 0px; + /* gap: 6px; */ + } + + .main-container-deposit { + width: 500px; + margin: auto; + padding-top: 0px; + } + + + .main-card-deposit{ + width: 500px; + margin: auto; + } + + .deposit-button { + width: 500px; + } + } + + + + @media (max-width: 480px) { + .deposit-container { + gap: 20px; + } + + .deposital-title { + font-size: 20px; + } + + .top-cards-deposit { + width: 380px; + gap: 8px; + height: 88px; + margin-top: -6px; + } + + .main-container-deposit { + width: 500px; + margin: 0; + padding-top: 0px; + } + + .deposit-title { + font-size: 16px; + } + + .main-card-deposit { + padding: 0 1.5rem 2.5rem 1.5rem; + width: 430px; + border: none; + } + + .amount-stack-card { + padding: 1rem; + } + + .deposit-input-title { + font-size: 12px; + } + + .deposit-input { + padding: 2rem 1rem; + } + + .deposit-input::placeholder { + font-size: 12px; + } + + .larger-screen-btn { + display: none; + } + + .mobile-screen-btns{ + display: flex; + flex-direction: row-reverse; + justify-content: center; + align-items: center; + gap: 4px; + width: 400px; + margin: 0 auto; + } + + .btn { + width: 50%; + + } + + .deposit-button { + height: 70px; + font-size: 14px; + padding: 28px 0px; + line-height: 19px; + margin-right: 10px; + } + + .cancel-button { + display: block; + background: none; + border: var(--midnight-purple-border); + border-radius: 8px; + padding: 28px 0px; + font-size: 14px; + color: var(--primary); + text-align: center; + line-height: 19px; + font-weight: 600; + } + + } + + @media (max-width: 425px) { + .top-cards-deposit { + width: 340px; + gap: 8px; + } + + .main-card { + width: 340px; + border: 1px solid; + } + + .amount-stack-card { + padding: .8rem; + width: 340px; + margin: auto; + } + + .deposit-title { + font-size: 14px; + } + + .deposit-input { + width: 340px; + margin: auto 22px; + } + + .deposit-input-title { + margin: auto 22px; + padding-bottom: 8px; + } + + .divider { + width: 340px; + margin: 8px 22px; + } + + .settings-fee-container { + width: 340px; + margin: auto; + } + + .mobile-screen-btns{ + width: 340px; + } + + } + + + @media (max-width: 380px) { + .top-cards-deposit { + width: 330px; + gap: 8px; + } + + .amount-stack-card { + width: 330px; + margin: auto; + } + + .deposit-input { + width: 330px; + margin: auto 28px; + } + + .deposit-input-title { + margin: auto 28px; + } + + .divider { + width: 330px; + margin: 8px 26px; + } + + .settings-fee-container { + width: 320px; + margin: auto 26px; + } + + .mobile-screen-btns{ + width: 320px; + } + } + + + @media (max-width: 375px) { + .top-cards-deposit { + width: 280px; + gap: 8px; + } + .main-card { + min-height: 200px; + width: 280px; + margin:auto; + + } + + .amount-stack-card { + width: 280px; + margin: auto; + } + + .deposit-input { + width: 280px; + margin: auto 50px; + } + + .deposit-input-title { + margin: auto 50px; + } + + .divider { + width: 280px; + margin: 8px 50px; + } + + .settings-fee-container { + width: 280px; + margin: auto 50px; + } + + .mobile-screen-btns{ + width: 280px; + } + } + \ No newline at end of file diff --git a/frontend/src/pages/spotnet/dashboard/add_deposit.jsx b/frontend/src/pages/spotnet/dashboard/add_deposit.jsx new file mode 100644 index 00000000..aee8b661 --- /dev/null +++ b/frontend/src/pages/spotnet/dashboard/add_deposit.jsx @@ -0,0 +1,55 @@ + +import React,{useState} from 'react'; +import Card from 'components/Card/Card'; +import './add_deposit.css'; +import TokenSelectorDeposit from 'components/TokenSelector/TokenSelector'; +import { ReactComponent as HealthIcon } from 'assets/icons/health.svg'; +import { ReactComponent as EthIcon } from 'assets/icons/ethereum.svg'; +export default function Add_Deposit() { + const [amount, setAmount] = useState('0'); + const handleAmountChange = (e) => { + const value = e.target.value; + const regex = /^\d*\.?\d*$/; + if (regex.test(value)) { + setAmount(value); + } + }; + + return ( +
+
+

zkLend Deposit

+
+
+ } /> + } /> +
+
+

Pls make a deposit

+
+ + + +
+ +
+ + + STRK + +
+ + +
+
+ ) +} From 3fd09ff03ac255e9da2bcd8b059d53a9366c81fe Mon Sep 17 00:00:00 2001 From: Stephanie Nwankwo <63151237+GoSTEAN@users.noreply.github.com> Date: Fri, 20 Dec 2024 18:38:00 +0000 Subject: [PATCH 2/3] fix: add-deposit --- frontend/src/App.jsx | 5 +- frontend/src/components/TokenSelector.jsx | 4 +- .../TokenSelector/TokenSelector.css | 171 ++++-------------- .../TokenSelector/TokenSelector.jsx | 8 +- .../AddDeposit.css} | 165 +++++++++++++---- .../dashboard/add-deposit/AddDeposit.jsx | 62 +++++++ 6 files changed, 235 insertions(+), 180 deletions(-) rename frontend/src/pages/spotnet/dashboard/{add_deposit.css => add-deposit/AddDeposit.css} (77%) create mode 100644 frontend/src/pages/spotnet/dashboard/add-deposit/AddDeposit.jsx diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index d36243ab..dbde185d 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -22,7 +22,8 @@ import { TELEGRAM_BOT_LINK } from 'utils/constants'; import { useCheckMobile } from 'hooks/useCheckMobile'; import { notifyError } from 'utils/notification'; import PositionHistory from 'pages/spotnet/position_history/PositionHistory'; -import Add_Deposit from 'pages/spotnet/dashboard/add_deposit'; +import AddDeposit from 'pages/spotnet/dashboard/add-deposit/AddDeposit'; + function App() { @@ -105,7 +106,7 @@ function App() { element={walletId ? : } /> } /> - } /> + } /> } /> } /> } /> diff --git a/frontend/src/components/TokenSelector.jsx b/frontend/src/components/TokenSelector.jsx index f8e7ec04..a35c0144 100644 --- a/frontend/src/components/TokenSelector.jsx +++ b/frontend/src/components/TokenSelector.jsx @@ -13,11 +13,11 @@ const TokenSelector = ({ selectedToken, setSelectedToken }) => { return (
{Tokens.map((token) => ( -
+
* { - color: var(--primary); -} -.form-container label { - color: var(--gray); - font-size: 1rem; -} .token-select { margin: 8px 0 8px 0; @@ -97,7 +57,7 @@ margin: 20px 0 12px 0; } -.token-card h5 { +.token-card-btn h5 { margin-top: 9px; font-size: 16px; font-size: 16px; @@ -108,18 +68,17 @@ gap: 6px; } -.token-card svg { +.token-card-btn svg { width: 20px; height: 20px; width: 20px; height: 20px; } - -.form-token { +.token-deposit { display: flex; justify-content: center; align-items: center; - gap: 80px; + gap: 8px; margin-bottom: 20px; } @@ -215,37 +174,13 @@ input[type='number'].error { color: var(--black); } -.form-button { - width: 642px; - border: solid 5px transparent; - height: 60px; - border-radius: inherit; - font-size: 20px; - font-family: var(--text-font); - font-weight: 700; - color: var(--primary); - background-color: hsla(265, 65%, 8%, 1); -} -.form-button-container { - margin-top: 20px; - padding: 1px; -} .balance-card { max-width: 100%; margin-top: 20px; } -.form-alert { - display: flex; - align-items: center; -} - -.form-alert-hex { - margin-left: auto; -} - .balance-container { display: flex; justify-content: space-between; @@ -316,36 +251,15 @@ input[type='number'].error { /* Responsiveness */ /* Mobile */ @media (max-width: 768px) { - .form-content-wrapper { - gap: 0; - } - - .form-container { - padding: 0; - margin-left: 0; - margin-right: 0; - width: 100%; - padding: 1rem; - } - - .form-container > form { - padding: 0 1rem; - } - - .form-button { - font-size: 16px; - } - .form-token { - max-width: 100%; - overflow-x: scroll; - gap: 40px; - scrollbar-width: none; + .token-card-btn label { + width: 79.5px; + height: 36px; + padding: 4px 8px; } + + } - .form-container label { - font-size: 12px; - } .balance-container { flex-direction: row; @@ -408,31 +322,29 @@ input[type='number'].error { font-size: 14px; } - .form-title h1 { - text-align: center; - font-weight: normal; - font-size: 1rem; - margin-bottom: 20px; - } + .token-icon{ + display: grid; + gap: 4px; + } - .token-icon { + .token-icon-deposit { margin-right: 5px; position: relative; z-index: 1; } - .token-card { + .token-card-btn { width: auto; height: auto; } - .token-card h5 { + .token-card-btn h5 { margin: 0; font-size: 14px; gap: 0; } - .token-card svg { + .token-card-btn svg { width: 15px; height: 15px; } @@ -442,14 +354,9 @@ input[type='number'].error { font-size: 14px; } - .token-card label { - border-radius: 12px; - max-width: max-content; - padding: 4px 8px; - } + .token-container { - border-radius: 12px; max-width: fit-content; position: relative; } @@ -479,14 +386,13 @@ input[type='number'].error { .token-amount { margin: 25px 0 12px 0; } -} -@media (max-width: 480px) { - .form-token { - max-width: 100%; - overflow-x: scroll; - gap: 16px; - scrollbar-width: none; + +@media (min-width:768px) { + .token-card-btn label { + width: 208.67px; + height: 40px; + padding: 4px 8px; } } @@ -506,11 +412,6 @@ input[type='number'].error { width: 400px; } - .form-token label, - .multiplier-card label { - width: auto; - height: 60px; - } input[type='number'] { height: 60px; diff --git a/frontend/src/components/TokenSelector/TokenSelector.jsx b/frontend/src/components/TokenSelector/TokenSelector.jsx index f6e66774..50d07caf 100644 --- a/frontend/src/components/TokenSelector/TokenSelector.jsx +++ b/frontend/src/components/TokenSelector/TokenSelector.jsx @@ -11,10 +11,10 @@ const Tokens = [ const TokenSelectorDeposit = ({ selectedToken, setSelectedToken }) => { return ( -
+
{Tokens.map((token) => ( -
-
+
+
{ />
diff --git a/frontend/src/pages/spotnet/dashboard/add_deposit.css b/frontend/src/pages/spotnet/dashboard/add-deposit/AddDeposit.css similarity index 77% rename from frontend/src/pages/spotnet/dashboard/add_deposit.css rename to frontend/src/pages/spotnet/dashboard/add-deposit/AddDeposit.css index 7e4a0833..133ebba5 100644 --- a/frontend/src/pages/spotnet/dashboard/add_deposit.css +++ b/frontend/src/pages/spotnet/dashboard/add-deposit/AddDeposit.css @@ -1,13 +1,5 @@ -body { - font-family: - 'Rethink Sans', - -apple-system, - Roboto, - Helvetica, - sans-serif; - } .deposit-wrapper { - background: url('../../../../public/background.png') no-repeat; + background: url('../../../../../public/background.png') no-repeat; background-size: cover; background-position: center 39%; min-height: 100vh; @@ -19,6 +11,8 @@ body { transition: all 0.2s ease-in-out; padding-bottom:4rem; } + + .deposit-container { display: flex; @@ -58,7 +52,7 @@ body { } .deposit-title2 { - font-size: 14px; + font-size: 20px; font-weight: 400; color: var(--primary); text-align: center; @@ -84,17 +78,46 @@ body { border:none; } - .token-select-dep{ - color: #83919F; - padding:15px 8px; - margin-left:2rem; - } + .deposit-token{ border: none; border-radius:8px; background-color: white; } + .currency-deposit { + position: absolute; + color: var(--dark-gray); + right: 27%; + top: 18%; + transform: translateY(-50%); + opacity: 0.5; + font-size: 16px; + line-height: 20.83px; + z-index: 999999; + } + + .amount-input-deposit { + position: relative; + width: 100%; + max-width: 400px; + margin: 2rem auto; + text-align: center; + font-weight: 600; + font-size: 64px; + } + + .amount-field-deposit { + background: transparent; + border: none; + color: var(--gray); + font-size: 64px; + font-weight: 600; + outline: none; + text-align: center; + width: 100%; + } + .amount-stack-card { background: var(--footer-divider-bg); @@ -177,22 +200,7 @@ body { height: 16px; } - .deposit-button { - position: relative; - display: inline-block; - font-weight: 600; - /* width: 642px; */ - width: 100%; - height: 60px; - background: none; - color: var(--primary); - font-size: 16px; - cursor: pointer; - border: none; - padding: 16px 24px 16px 24px; - z-index: 1; - overflow: hidden; - } + .deposit-button::before { content: ''; @@ -247,19 +255,58 @@ body { .deposit-container { margin-left: 0px; } + + .token-select-dep{ + color: #83919F; + padding:20px 10px; + + } + + .dep-button{ + display: flex; + gap: 8px; + } + + .deposit-cancel-button { + position: relative; + + font-weight: 600; + /* width: 642px; */ + width: 167px; + height: 60px; + background: none; + color: var(--primary); + font-size: 16px; + cursor: pointer; + border: none; + padding: 16px 24px 16px 24px; + z-index: 1; + overflow: hidden; + } + + .deposit-button { + position: relative; + + font-weight: 600; + /* width: 642px; */ + width: 167px; + height: 60px; + background: none; + color: var(--primary); + font-size: 16px; + cursor: pointer; + border: none; + padding: 16px 24px 16px 24px; + z-index: 1; + overflow: hidden; + } } @media (max-width: 680px){ .deposit-container { - /* margin-top: -120px; - margin-left: 0px; */ } - /* .deposital-title { - font-size: 24px; - } */ - .deposital-title { margin: 0; } @@ -502,5 +549,49 @@ body { .mobile-screen-btns{ width: 280px; } + + + } + + @media (min-width:768px) { + .token-select-dep{ + color: #83919F; + padding:20px 0px; + + } + + .deposit-button { + position: relative; + display: inline-block; + font-weight: 600; + /* width: 642px; */ + width: 100%; + height: 60px; + background: none; + color: var(--primary); + font-size: 16px; + cursor: pointer; + border: none; + padding: 16px 24px 16px 24px; + z-index: 1; + overflow: hidden; + } + + .deposit-cancel-button { + position: relative; + display: none; + font-weight: 600; + /* width: 642px; */ + width: 100%; + height: 60px; + background: none; + color: var(--primary); + font-size: 16px; + cursor: pointer; + border: none; + padding: 16px 24px 16px 24px; + z-index: 1; + overflow: hidden; + } } \ No newline at end of file diff --git a/frontend/src/pages/spotnet/dashboard/add-deposit/AddDeposit.jsx b/frontend/src/pages/spotnet/dashboard/add-deposit/AddDeposit.jsx new file mode 100644 index 00000000..daa8aa45 --- /dev/null +++ b/frontend/src/pages/spotnet/dashboard/add-deposit/AddDeposit.jsx @@ -0,0 +1,62 @@ + +import React, { useState } from 'react'; +import Card from 'components/Card/Card'; +import TokenSelectorDeposit from 'components/TokenSelector/TokenSelector'; +import { ReactComponent as HealthIcon } from 'assets/icons/health.svg'; +import { ReactComponent as EthIcon } from 'assets/icons/ethereum.svg'; +import './AddDeposit.css'; + +export default function AddDeposit() { + + const [amount, setAmount] = useState('0'); + const handleAmountChange = (e) => { + const value = e.target.value; + const regex = /^\d*\.?\d*$/; + if (regex.test(value)) { + setAmount(value); + } + }; + + return ( +
+
+

zkLend Deposit

+
+
+ } /> + } /> +
+
+

Pls make a deposit

+
+ + + +
+ +
+ + + STRK + +
+ +
+ + +
+ + +
+
+ ) +} From cf0d2c6c2575995f1b8419ba24f83579f6660a2d Mon Sep 17 00:00:00 2001 From: Stephanie Nwankwo <63151237+GoSTEAN@users.noreply.github.com> Date: Sat, 21 Dec 2024 10:22:26 +0000 Subject: [PATCH 3/3] fixed:add-deposit-page --- frontend/src/pages/forms/Form.jsx | 4 +- .../dashboard/add-deposit/AddDeposit.css | 274 ++---------------- .../dashboard/add-deposit/AddDeposit.jsx | 17 +- frontend/src/utils/regex.js | 5 + 4 files changed, 32 insertions(+), 268 deletions(-) create mode 100644 frontend/src/utils/regex.js diff --git a/frontend/src/pages/forms/Form.jsx b/frontend/src/pages/forms/Form.jsx index 8a0d817f..7e7cbd27 100644 --- a/frontend/src/pages/forms/Form.jsx +++ b/frontend/src/pages/forms/Form.jsx @@ -2,7 +2,6 @@ import React, { useState } from 'react'; import { ReactComponent as ETH } from '../../assets/icons/ethereum.svg'; import { ReactComponent as USDC } from '../../assets/icons/borrow_usdc.svg'; import { ReactComponent as STRK } from '../../assets/icons/strk.svg'; -import TokenSelector from 'components/TokenSelector'; import BalanceCards from 'components/BalanceCards'; import MultiplierSelector from 'components/MultiplierSelector'; import { handleTransaction } from 'services/transaction'; @@ -19,6 +18,7 @@ import { useCheckPosition } from 'hooks/useClosePosition'; import { useNavigate } from 'react-router-dom'; import { ActionModal } from 'components/ui/ActionModal'; import { useHealthFactor } from 'hooks/useHealthRatio'; +import TokenSelectorDeposit from 'components/TokenSelector/TokenSelector'; const Form = () => { const navigate = useNavigate(); @@ -123,7 +123,7 @@ const Form = () => {

)} - + { const value = e.target.value; - const regex = /^\d*\.?\d*$/; - if (regex.test(value)) { + if (validateNumberInput(value)) { setAmount(value); } }; @@ -29,9 +29,8 @@ export default function AddDeposit() {

Pls make a deposit

- + -
@@ -51,12 +50,10 @@ export default function AddDeposit() {
- - + +
- -
- ) + ); } diff --git a/frontend/src/utils/regex.js b/frontend/src/utils/regex.js new file mode 100644 index 00000000..ecda413f --- /dev/null +++ b/frontend/src/utils/regex.js @@ -0,0 +1,5 @@ +// regex.jsx +export const validateNumberInput = (value) => { + const regex = /^\d*\.?\d*$/; + return regex.test(value); + }; \ No newline at end of file