Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced Loan Section #513

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions frontend/public/images/calc.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
148 changes: 123 additions & 25 deletions frontend/src/pages/Loan/Loan.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
:root {
--primary-color: #2b4b77;
--primary-color: #0D92F4;
--secondary-color: #4a90e2;
--tertiary-color: #86c5da;
--tertiary-color: #D2E0FB;
--background-color: #f8f9fa;
--text-color: #333;
--card-background: #ffffff;
Expand Down Expand Up @@ -41,12 +41,11 @@ body {

.loan-title {
font-size: 2.8rem;
background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
-webkit-background-clip: text;
color: transparent;
color:#091057;
margin-bottom: 1.5rem;
text-align: center;
text-transform: uppercase;
font-family:'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
font-weight: bold;
animation: slideIn var(--transition-speed) ease-in-out;
}

Expand Down Expand Up @@ -90,20 +89,22 @@ body {
}

.loan-section h2 {
font-size: 1.8rem;
color: var(--primary-color);
margin-bottom: 10px;
font-size: 1.5rem;
color: #024CAA;
margin-bottom: 12px;
position: relative;
font-weight: 600;

}

.loan-section h2::after {
content: '';
display: block;
width: 60px;
height: 4px;
height: 3px;
background: var(--secondary-color);
position: absolute;
bottom: -10px;
bottom: -7px;
left: 0;
transition: width var(--transition-speed);
}
Expand Down Expand Up @@ -298,31 +299,39 @@ body {
transition: .2s linear;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
display: flex;
flex-direction: column;
align-items: left;
align-items: center;
justify-content: center;



}


.loan-calculator:hover {
transform: translateY(-5px);
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.loan-calculator h2 {
font-size: 2rem;
color: var(--primary-color);
color: #091057;
margin-bottom: 2rem;
text-align: center;
font-weight: 600;
}

.calculator-form {
display: flex;
flex-direction: column;
gap: 1.5rem;


}

.calculator-form label {
font-weight: bold;
display: flex;
flex-direction: column;
}

.calculator-form input,
Expand All @@ -333,8 +342,13 @@ body {
transition: border-color 0.3s;
margin-left: 20px;
box-shadow: none;
width:40vw;
}
.btn-container{
display: flex;
justify-content:start;
width:50vw;
}

.calculator-form input:focus,
.calculator-form select:focus {
border-color: var(--accent-color);
Expand All @@ -344,39 +358,54 @@ body {
background: var(--primary-color);
color: #fff;
font-size: 1rem;
width: 50%;
cursor: pointer;
padding: 0.75rem 1.5rem;
padding: 0.75rem 1.2rem;
transition: background-color 0.3s;
transition: .2s linear;
}

.loan-button:hover {
width: 50%;
.btn-container button{
width:42vw;
}
.btn-container:hover{
padding-left:10px;
}

.loan-button:hover {
background-color: var(--secondary-color);

}

.calculator-result {
display: flex;
flex-direction: column;
margin-top: 1rem;
background: var(--card-background);
padding: 1rem;
border-radius: var(--border-radius);
box-shadow: var(--box-shadow);

}


.calculator-result h3 {
font-size: 1.8rem;
color: var(--primary-color);
font-size: 1.3rem;
color: #091057;
text-align: center;
margin-bottom: 10px;
font-weight: bold;

}
.summary{
display: flex;
justify-content: space-evenly;
}

.calculator-result p {
font-size: 1.2rem;
text-align: center;
color: #555;
}
.calculator-result span{
font-weight: bold;
font-size: small;
}

@media (max-width: 768px) {
.horizontal-cards {
Expand All @@ -394,3 +423,72 @@ body {
}
}

.types-of-loans ul{
display: flex;
gap: 10px;
flex-wrap: wrap;

}

.types-of-loans li{
border:2px solid #024CAA;
padding-inline:20px;
padding-block:10px;
border-radius: 10px;
width:max-content;
color:rgb(2, 2, 79);
display:inline-flex;
align-items: center;
gap:10px;


}

.types-of-loans{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap:5px;
}

.loan-section h2{
margin-bottom: 1.5rem;
}
.tips .h2{
display:flex;
align-items: center;
justify-content: center;
gap:10px;
font-size: 1.5rem;
color: #024CAA;
margin-bottom: 12px;
position: relative;
font-weight: 600;
}
.tips li{
border:2px solid #024CAA;
padding-inline:20px;
padding-block:10px;
border-radius: 30px;
display:inline-flex;
align-items: center;
gap:10px;
color:#091057;
}

.tips ul{
display: flex;
flex-direction: column;
gap:4px;

}

.img-container{
border:2px solid blue;
width:40vw;
}

.div-form{
width:45vw;
}
46 changes: 33 additions & 13 deletions frontend/src/pages/Loan/Loan.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import React, { useState } from 'react';
import './Loan.css'; // Import your custom CSS file
import { FaHandPointRight, FaCaravan } from "react-icons/fa";
import { MdTipsAndUpdates } from "react-icons/md";
import { AiFillCreditCard } from "react-icons/ai";
import { FaHouse } from "react-icons/fa6";
import { PiStudentFill } from "react-icons/pi";

const Loan = () => {
const [loanAmount, setLoanAmount] = useState('');
Expand Down Expand Up @@ -76,10 +81,10 @@ const Loan = () => {
<section className="loan-section types-of-loans">
<h2>Types of Loans</h2>
<ul>
<li>Personal Loans</li>
<li>Student Loans</li>
<li>Mortgage Loans</li>
<li>Auto Loans</li>
<li><span><AiFillCreditCard /></span>Personal Loans</li>
<li><span><PiStudentFill /></span>Student Loans</li>
<li><span><FaHouse /></span>Mortgage Loans</li>
<li><span><FaCaravan /></span>Auto Loans</li>
</ul>
<a href="https://en.wikipedia.org/wiki/Loan#Types" target='_blank' rel="noopener noreferrer">
<button className="loan-button">View Details</button>
Expand All @@ -88,17 +93,23 @@ const Loan = () => {
</div>

<section className="loan-section tips">
<div className='h2'>
<span><MdTipsAndUpdates /></span>
<h2>Tips for Applying for Loans and Grants</h2>
<span><MdTipsAndUpdates /></span>
</div>

<ul>
<li>Check your credit score before applying.</li>
<li>Research various options to find the best terms.</li>
<li>Gather necessary documentation in advance.</li>
<li>Be clear about your purpose and how you plan to use the funds.</li>
<li><span><FaHandPointRight /></span>Check your credit score before applying.</li>
<li><span><FaHandPointRight /></span>Research various options to find the best terms.</li>
<li><span><FaHandPointRight /></span>Gather necessary documentation in advance.</li>
<li><span><FaHandPointRight /></span>Be clear about your purpose and how you plan to use the funds.</li>
</ul>
</section>

<section className="loan-calculator">
<h2>Loan Calculator</h2>
<div className='div-form'>
<h2>Loan Calculator</h2>
<form className="calculator-form" onSubmit={(e) => e.preventDefault()}>
<label htmlFor="loanAmount">
Loan Amount:
Expand Down Expand Up @@ -145,19 +156,28 @@ const Loan = () => {
<option value="weekly">Weekly</option>
</select>
</label>
<div className='btn-container'>
<button onClick={calculateLoan} className="loan-button">Calculate</button>

</div>
</form>
{calculationResult && (
<div className="calculator-result">
<h3>Loan Summary:</h3>
<p>{calculationResult.frequency} Payment: ${calculationResult.paymentPerPeriod}</p>
<p>Total Payment: ${calculationResult.totalPayment}</p>
<p>Total Interest: ${calculationResult.totalInterest}</p>
<div class="summary">
<p><span>{calculationResult.frequency} Payment:</span> ${calculationResult.paymentPerPeriod}</p>
<p><span>Total Payment:</span> ${calculationResult.totalPayment}</p>
<p><span>Total Interest:</span> ${calculationResult.totalInterest}</p>
</div>
</div>
)}
</div>
<div className='img-container'>
<img src='/images/calc.jpg' width={400} height={100}/>
</div>
</section>
</div>
);
};

export default Loan;
export default Loan;