|
| 1 | +import { useState } from "react" |
| 2 | + |
| 3 | +const TEMP = [ |
| 4 | + { |
| 5 | + amount: '5000.00', |
| 6 | + address: '0x65e0D3DB067222AfE5FAD1Ff60ebF29bE4cF6207', |
| 7 | + repay: '10', |
| 8 | + collateralAmt: '5000' |
| 9 | + }, |
| 10 | + { |
| 11 | + amount: '2300.00', |
| 12 | + address: '0x65e0D3DB067222AfE5FAD1Ff60ebF29bE4cF6207', |
| 13 | + repay: '10', |
| 14 | + collateralAmt: '5000' |
| 15 | + }, |
| 16 | + { |
| 17 | + amount: '450.00', |
| 18 | + address: '0x65e0D3DB067222AfE5FAD1Ff60ebF29bE4cF6207', |
| 19 | + repay: '10', |
| 20 | + collateralAmt: '5000' |
| 21 | + }, |
| 22 | + { |
| 23 | + amount: '450.00', |
| 24 | + address: '0x65e0D3DB067222AfE5FAD1Ff60ebF29bE4cF6207', |
| 25 | + repay: '10', |
| 26 | + collateralAmt: '5000' |
| 27 | + } |
| 28 | +] |
1 | 29 | const Lend = () => { |
| 30 | + const [selectedBorrower, setSelectedBorrower] = useState(null) |
| 31 | + |
2 | 32 | return ( |
3 | 33 | <div className="flex flex-col gap-y-[30px] w-[100%] h-[100%] text-white p-[20px] px-[30px] text-inter"> |
4 | 34 |
|
5 | | - <button |
| 35 | + {!selectedBorrower && <div className="flex flex-col gap-y-[20px]"> |
| 36 | + { |
| 37 | + TEMP.map((data, index) => { |
| 38 | + return ( |
| 39 | + <div className="flex flex-col gap-y-[20px] font-inter"> |
| 40 | + <div className="flex flex-row gap-x-[20px]"> |
| 41 | + <div className=""> |
| 42 | + {index+1}. |
| 43 | + </div> |
| 44 | + |
| 45 | + <div className="flex flex-col gap-y-[5px]"> |
| 46 | + <div className="flex flex-row items-center"> |
| 47 | + {data.amount} |
| 48 | + <img className="w-[20px] h-[20px] rounded-full ml-[5px]" src="./assets/usdc.svg" alt="usdcLogo"/> |
| 49 | + </div> |
| 50 | + <div className="text-gray-200 text-[10px] font-medium">{data.address}</div> |
| 51 | + <div className="text-[14px]">{data.repay} days</div> |
| 52 | + <div className="flex flex-row items-center text-[14px]"> |
| 53 | + <div>Collateral amount: </div> |
| 54 | + {data.collateralAmt} |
| 55 | + <div className="flex justify-center w-[20px] h-[20px] rounded-full bg-white p-[4px] box-border ml-[5px]"> |
| 56 | + <img src="./assets/matic.svg" alt="maticLogo"/> |
| 57 | + </div> |
| 58 | + </div> |
| 59 | + </div> |
| 60 | + |
| 61 | + <button |
| 62 | + type="submit" |
| 63 | + className="bg-blue py-[8px] px-[24px] ml-auto rounded-lg text-white font-inter font-medium self-start" |
| 64 | + onClick={() => {setSelectedBorrower(data)}} |
| 65 | + > |
| 66 | + Lend |
| 67 | + </button> |
| 68 | + </div> |
| 69 | + { |
| 70 | + index <= TEMP.length && |
| 71 | + <div className="h-[0.5px] self-center bg-gray-100 w-[100%] "></div>} |
| 72 | + </div> |
| 73 | + ) |
| 74 | + }) |
| 75 | + } |
| 76 | + </div>} |
| 77 | + |
| 78 | + { |
| 79 | + selectedBorrower && |
| 80 | + |
| 81 | + <> |
| 82 | + <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" className="w-6 h-6 cursor-pointer" |
| 83 | + onClick={() => {setSelectedBorrower(null)}} |
| 84 | + > |
| 85 | + <path strokeLinecap="round" strokeLinejoin="round" d="M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18" /> |
| 86 | + </svg> |
| 87 | + |
| 88 | + |
| 89 | + <div className="flex flex-row items-center"> |
| 90 | + <div className="font-inter text-[16px] font-medium"> |
| 91 | + Loan amount: |
| 92 | + </div> |
| 93 | + |
| 94 | + <div className="ml-auto bg-transparent text-right text-[#696c80] font-medium outline-none">{selectedBorrower.amount}</div> |
| 95 | + <div className="flex flex-row items-center gap-x-[10px] text-[14px] text-white w-auto h-[40px] p-[5px] px-[8px] rounded-[20px] font-medium pr-[15px] ml-[25px] bg-[#404557]"> |
| 96 | + <img className="w-[30px] h-[30px] rounded-full" src="./assets/usdc.svg" alt="usdcLogo"/> |
| 97 | + USDC |
| 98 | + </div> |
| 99 | + </div> |
| 100 | + |
| 101 | + <div className="flex flex-row items-center"> |
| 102 | + <div className="font-inter text-[16px] font-medium">Expected repay duration:</div> |
| 103 | + <div className="ml-auto bg-transparent text-right text-[#696c80] font-medium mr-[10px] outline-none">{selectedBorrower.repay}</div> |
| 104 | + <div>days</div> |
| 105 | + </div> |
| 106 | + |
| 107 | + <div className="flex flex-row items-center"> |
| 108 | + |
| 109 | + <div className="font-inter text-[16px] font-medium">Interest %:</div> |
| 110 | + <div className="ml-auto bg-transparent text-right text-[#696c80] font-medium mr-[10px] outline-none">13%</div> |
| 111 | + <div>APR</div> |
| 112 | + |
| 113 | + </div> |
| 114 | + |
| 115 | + <div className="flex flex-row items-center"> |
| 116 | + |
| 117 | + <div className="font-inter text-[16px] font-medium">Interest Amount:</div> |
| 118 | + <div className="ml-auto text-right text-[#696c80] font-medium mr-[10px]">9999</div> |
| 119 | + <div className="flex flex-row items-center gap-x-[10px] text-[14px] text-white w-auto h-[40px] p-[5px] px-[8px] rounded-[20px] font-medium pr-[15px] ml-[10px] bg-[#404557]"> |
| 120 | + <img className="w-[30px] h-[30px] rounded-full" src="./assets/usdc.svg" alt="usdcLogo"/> |
| 121 | + USDC |
| 122 | + </div> |
| 123 | + |
| 124 | + </div> |
| 125 | + |
| 126 | + <div className="flex flex-row items-center"> |
| 127 | + |
| 128 | + <div className="font-inter text-[16px] font-medium">Required collateral:</div> |
| 129 | + <div className="ml-auto text-right text-[#696c80] font-medium mr-[10px]">9999</div> |
| 130 | + <div className="flex flex-row items-center gap-x-[10px] text-[14px] text-white w-auto h-[40px] p-[5px] px-[8px] rounded-[20px] font-medium pr-[15px] ml-[10px] bg-[#404557]"> |
| 131 | + <div className="flex justify-center w-[30px] h-[30px] rounded-full bg-white p-[4px] box-border"> |
| 132 | + <img src="./assets/matic.svg" alt="maticLogo"/> |
| 133 | + </div> |
| 134 | + MATIC |
| 135 | + </div> |
| 136 | + </div> |
| 137 | + |
| 138 | + <button |
| 139 | + type="submit" |
| 140 | + className="bg-blue py-[8px] px-[24px] rounded-lg text-white justify-center self-center font-inter font-medium" |
| 141 | + > |
| 142 | + Confirm Borrow |
| 143 | + </button> |
| 144 | + |
| 145 | + <div className="flex flex-row items-center gap-x-[5px] font-[300] text-gray-400 text-[12px] self-center mt-[-10px]"> |
| 146 | + <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" className="w-[15px] h-[15px]"> |
| 147 | + <path strokeLinecap="round" strokeLinejoin="round" d="M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z" /> |
| 148 | + </svg> |
| 149 | + on conforming collateral amount will be deducted from your account |
| 150 | + </div> |
| 151 | + </> |
| 152 | + } |
| 153 | + |
| 154 | + {/* <button |
6 | 155 | type="submit" |
7 | 156 | className="bg-blue py-[8px] px-[24px] rounded-lg text-white justify-center self-center font-inter font-medium" |
8 | 157 | > |
9 | | - Confirm Borrow |
| 158 | + Confirm Lend |
10 | 159 | </button> |
11 | 160 |
|
12 | 161 | <div className="flex flex-row items-center gap-x-[5px] font-[300] text-gray-400 text-[12px] self-center mt-[-10px]"> |
13 | 162 | <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" className="w-[15px] h-[15px]"> |
14 | 163 | <path strokeLinecap="round" strokeLinejoin="round" d="M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z" /> |
15 | 164 | </svg> |
16 | | - on conforming collateral amount will be deducted from your account</div> |
| 165 | + on conforming collateral amount will be deducted from your account</div> */} |
17 | 166 | </div> |
18 | 167 | ) |
19 | 168 | } |
|
0 commit comments