-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into refac-form-page
- Loading branch information
Showing
35 changed files
with
1,018 additions
and
3,166 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions
37
frontend/src/components/dashboard/dashboardCard/DashboardInfoCard.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { useState } from "react"; | ||
import DashboardTabs from "@/components/dashboard/dashboard-tab/DashboardTabs" | ||
import Collateral from "@/components/dashboard/collateral/Collateral" | ||
import Borrow from "@/components/dashboard/borrow/Borrow" | ||
import Deposited from "@/components/dashboard/deposited/Deposited" | ||
import { DASHBOARD_TABS } from "@/utils/constants" | ||
|
||
|
||
export default function DashboardInfoCard({ cardData, startSum, currentSum, depositedData }) { | ||
const [activeTab, setActiveTab] = useState(DASHBOARD_TABS.COLLATERAL) | ||
const { COLLATERAL, BORROW, DEPOSITED } = DASHBOARD_TABS | ||
|
||
const getCurrentSumColor = () => { | ||
if (currentSum > startSum) return "current-sum-green" | ||
if (currentSum < startSum) return "current-sum-red" | ||
return "" | ||
} | ||
|
||
return ( | ||
<div className="dashboard-info-card"> | ||
<DashboardTabs activeTab={activeTab} switchTab={setActiveTab} /> | ||
|
||
{activeTab === COLLATERAL && ( | ||
<Collateral | ||
getCurrentSumColor={getCurrentSumColor} | ||
startSum={startSum} | ||
currentSum={currentSum} | ||
data={cardData} | ||
/> | ||
)} | ||
|
||
{activeTab === BORROW && <Borrow data={cardData} />} | ||
|
||
{activeTab === DEPOSITED && <Deposited data={depositedData} />} | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from 'react'; | ||
import Rocket from '@/assets/icons/rocket.svg?react'; | ||
|
||
|
||
|
||
const GradientButton = ({ | ||
onClick, | ||
children, | ||
mobileWidth = 'w-[300px]', | ||
desktopWidth = 'lg:w-[400px]', | ||
icon = <Rocket />, | ||
className = '' | ||
}) => { | ||
return ( | ||
<button | ||
className={` | ||
bg-gradient-to-r from-[var(--button-gradient-from)] via-[var(--button-gradient-to)] to-[var(--button-gradient-to)] | ||
hover:bg-gradient-to-r hover:from-[var(--button-gradient-hover-from)] hover:via-[var(--button-gradient-from)] hover:to-[var(--button-gradient-hover-from)] | ||
border-none rounded-[8px] h-[52px] text-[20px] text-black font-[700] mt-[20px] 2xl:h-[60px] z-10 cursor-pointer | ||
${mobileWidth} ${desktopWidth} ${className} | ||
`} | ||
onClick={onClick} | ||
> | ||
<div className="justify-center items-center cursor-pointer flex gap-[20px]"> | ||
<span>{children}</span> | ||
{icon} | ||
</div> | ||
</button> | ||
); | ||
}; | ||
|
||
export default GradientButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.