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

Added a back button to the payment page #365

Closed
wants to merge 2 commits into from
Closed
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
43 changes: 23 additions & 20 deletions frontend/src/Pages/Payment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,33 @@ import React, { useState } from 'react';
import { useNavigate } from 'react-router-dom';
import backicon from '../assets/svg/backicon.svg';



const Payment = () => {
const [paymentMethod, setPaymentMethod] = useState('');
const [cardNumber, setCardNumber] = useState('');
const [expiryDate, setExpiryDate] = useState('');
const [cvv, setCvv] = useState('');
const [paymentMethod, setPaymentMethod] = useState("");
const [cardNumber, setCardNumber] = useState("");
const [expiryDate, setExpiryDate] = useState("");
const [cvv, setCvv] = useState("");

const navigate = useNavigate();

const handleSubmit = (e) => {
e.preventDefault();
console.log('Payment submitted:', { paymentMethod, cardNumber, expiryDate, cvv });
console.log("Payment submitted:", {
paymentMethod,
cardNumber,
expiryDate,
cvv,
});
};
const navigate = useNavigate();

const handleBack = () => {
navigate("/");
};

const HomeClick = () => {
navigate('/'); // Navigates to the home page
};
return (

<div className="min-h-screen flex justify-center items-center bg-blue-100">
<button onClick={HomeClick} className='absolute left-0 top-2'>
<img src={backicon} alt="" className='h-[5vh]' />
</button>
<button onClick={handleBack} className='absolute left-0 top-2'>
<img src={backicon} alt="Back" className='h-[5vh]' />
</button>
<div className="bg-white p-8 rounded-lg shadow-md w-full max-w-md">
<h1 className="text-3xl font-semibold text-blue-900 mb-6">Payment Page</h1>
<form onSubmit={handleSubmit}>
Expand All @@ -46,8 +49,8 @@ const Payment = () => {
<option value="google_pay">Google Pay</option>
</select>
</div>
{paymentMethod === 'credit_card' || paymentMethod === 'debit_card' ? (

{paymentMethod === "credit_card" || paymentMethod === "debit_card" ? (
<>
<div className="mb-4">
<label className="block text-gray-700 text-sm font-bold mb-2">
Expand Down Expand Up @@ -93,7 +96,7 @@ const Payment = () => {
</>
) : null}

{paymentMethod === 'apple_pay' || paymentMethod === 'google_pay' ? (
{paymentMethod === "apple_pay" || paymentMethod === "google_pay" ? (
<div className="mb-4">
<label className="block text-gray-700 text-sm font-bold mb-2">
UPI ID
Expand All @@ -105,7 +108,7 @@ const Payment = () => {
/>
</div>
) : null}

<button
type="submit"
className="w-full bg-blue-500 text-white font-bold py-2 px-4 rounded-md hover:bg-blue-600 transition duration-300"
Expand All @@ -118,4 +121,4 @@ const Payment = () => {
);
};

export default Payment;
export default Payment;