Skip to content

Commit

Permalink
updated input feild
Browse files Browse the repository at this point in the history
  • Loading branch information
incredible-phoenix246 committed Jan 6, 2024
1 parent 0679eb0 commit f8f5537
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 23 deletions.
6 changes: 5 additions & 1 deletion components/Modals/Removecart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { MouseEvent, useState } from 'react';
import Image from 'next/image';
import group from '../../public/assets/removecart/Group.png';
import trash from '../../public/assets/removecart/delete.svg';
import Modal from '@ui/Modal';

interface RemoveCartProps {
closeModal: () => void;
Expand All @@ -11,7 +12,10 @@ interface RemoveCartProps {

const RemoveCart: React.FC<RemoveCartProps> = ({ closeModal, onRemoveItem, productId }) => {
return (
<div className="fixed inset-0 flex items-center justify-center z-50 bg-[#00000080] bg-opacity-30">
<div
className="fixed inset-0 flex items-center justify-center z-50 bg-[#00000080] bg-opacity-30"
onClick={closeModal}
>
<div id="modal" className="bg-white-100 p-4 rounded-lg w-[90%] md:w-[50%] lg:w-[24%] h-415 text-center ">
<svg
onClick={closeModal}
Expand Down
14 changes: 7 additions & 7 deletions components/Modals/TempUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ const TempUser = ({ isOpen, onClose }: TempUser) => {
};
const payment = userForm.get('paymentMethod') as string;
const tempUser = await createTempUser(data);

if (tempUser.data.token) {
localStorage.setItem('trans_token',tempUser.data.token);
localStorage.setItem('trans_token', tempUser.data.token);

const cartItems = JSON.parse(localStorage.getItem('products') as string);
const cartIds = await getCardItemsId(cartItems);
Expand Down Expand Up @@ -75,7 +75,7 @@ const TempUser = ({ isOpen, onClose }: TempUser) => {
Firstname
</label>
<input
className="flex items-center justify-between w-full border border-[#E1E3E2] rounded-lg p-4 mb-4 focus:outline-none focus:border-brand-green-primary"
className="flex items-center justify-between w-full border border-[#E1E3E2] rounded-lg p-4 mb-4 focus:outline-none focus:border-brand-green-primary font-medium text-[16px]"
placeholder="Mark"
type="text"
name="first_name"
Expand All @@ -87,7 +87,7 @@ const TempUser = ({ isOpen, onClose }: TempUser) => {
Lastname
</label>
<input
className="flex items-center justify-between w-full border border-[#E1E3E2] rounded-lg p-4 mb-4 focus:outline-none focus:border-brand-green-primary"
className="flex items-center justify-between w-full border border-[#E1E3E2] rounded-lg p-4 mb-4 focus:outline-none focus:border-brand-green-primary font-medium text-[16px]"
placeholder="Essein"
type="text"
name="last_name"
Expand All @@ -99,7 +99,7 @@ const TempUser = ({ isOpen, onClose }: TempUser) => {
Email
</label>
<input
className="flex items-center justify-between w-full border border-[#E1E3E2] rounded-lg p-4 mb-4 focus:outline-none focus:border-brand-green-primary"
className="flex items-center justify-between w-full border border-[#E1E3E2] rounded-lg p-4 mb-4 focus:outline-none focus:border-brand-green-primary font-medium text-[16px]"
placeholder="[email protected]"
type="email"
name="email"
Expand All @@ -115,7 +115,7 @@ const TempUser = ({ isOpen, onClose }: TempUser) => {
name="paymentMethod"
value="paystack"
/>
<span className="ml-2">Pay with Paystack </span>
<span className="ml-2 font-medium text-[16px]">Pay with Paystack </span>
</label>
<Image src={paystack} alt="paystack" width={64} height={64} />
</div>
Expand All @@ -128,7 +128,7 @@ const TempUser = ({ isOpen, onClose }: TempUser) => {
name="paymentMethod"
value="flutterwave"
/>
<span className="ml-2">Pay with Flutterwave</span>
<span className="ml-2 font-medium text-[16px]">Pay with Flutterwave</span>
</label>
<Image src={flutterwave} alt="mastercard" width={76} height={76} />
</div>
Expand Down
13 changes: 5 additions & 8 deletions http/checkout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,15 @@ import $http from './axios';
import axios from 'axios';
import { AUTH_HTTP_URL } from './auth';



// export const CART_ENDPOINT = "https://zuri-cart-checkout.onrender.com/api/v1/checkout_cart"

export const STAGING_URL = process.env.NEXT_PUBLIC_APP_STAGING_URL || 'https://staging.zuri.team';
export const API_BASE_URL = process.env.NEXT_PUBLIC_BACKEND_ENDPOINT_URL || 'https://zuriportfolio-backend.onrender.com/api/v1'
export const API_BASE_URL =
process.env.NEXT_PUBLIC_BACKEND_ENDPOINT_URL || 'https://zuriportfolio-backend.onrender.com/api/v1';
export const RECENTLY_VIEWED_ENDPOINT = 'https://staging.zuri.team/api/marketplace/v1/recently-viewed';
export const CART_ENDPOINT = API_BASE_URL + "/checkout";
export const SHOP_API_URL = `${API_BASE_URL}/shop-internal`
export const PORTFOLIO_BASE_URL = `${API_BASE_URL}/portfolio`


export const CART_ENDPOINT = API_BASE_URL + '/checkout';
export const SHOP_API_URL = `${API_BASE_URL}/shop-internal`;
export const PORTFOLIO_BASE_URL = `${API_BASE_URL}/portfolio`;

export const addToCart = async (cartItems: string[], token: string) => {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const PaymentInformationModal = ({
{paymentButtonClicked ? (
<button
type="button"
className="bg-green-200 py-2 px-4 w-full rounded-md hover:bg-green-200 rounded text-white-100 flex justify-center items-center"
className="bg-green-200 py-2 px-4 w-full rounded-md hover:bg-green-200 text-white-100 flex justify-center items-center"
disabled
>
<svg className="animate-spin h-4 w-4 inline mr-2 text-[#f5f6f1]" viewBox="0 0 24 24">
Expand All @@ -120,7 +120,7 @@ const PaymentInformationModal = ({
) : (
<button
onClick={handlePayment}
className="py-2 px-4 w-full rounded-md hover:bg-green-600 bg-green-700 rounded text-white-100 "
className="py-2 px-4 w-full rounded-md hover:bg-green-600 bg-green-700 text-white-100 "
>
Proceed to pay
</button>
Expand Down
13 changes: 8 additions & 5 deletions modules/shop/component/cart/checkout/Summary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ import React, { useEffect, useState } from 'react';
import { CartSumaryProp, PriceData, SummaryProps } from '../../../../../@types';
import PaymentInformationModal from './PaymentInformationModal';
import TempUser from './../../../../../components/Modals/TempUser';
import useDisclosure from '../../../../../hooks/useDisclosure';
import isAuthenticated from '../../../../../helpers/isAuthenticated';
import CartPaymentModal from '../../../../../components/Modals/CartPaymentModal';
import { formatCurrency } from '../../../../../helpers/formatCurrency';

const Summary = ({ prices, summary, token }: SummaryProps & { token: string; summary: CartSumaryProp }) => {
Expand Down Expand Up @@ -71,7 +68,9 @@ const Summary = ({ prices, summary, token }: SummaryProps & { token: string; sum
<div className="cart-summary__prices flex flex-col space-y-3">
<div className="sum flex justify-between">
<p className="font-bold">Subtotal</p>
<span className="text-gray-200">{summary.subtotal ? formatCurrency(summary.subtotal.toFixed(2)) : ''}</span>
<span className="text-gray-200">
{summary.subtotal ? formatCurrency(summary.subtotal.toFixed(2)) : ''}
</span>
</div>

<div className="sum flex justify-between">
Expand Down Expand Up @@ -107,7 +106,11 @@ const Summary = ({ prices, summary, token }: SummaryProps & { token: string; sum
</button>
</div>
{token.length > 0 && modalOpen ? (
<PaymentInformationModal token={token} orderTotal={formatCurrency(summary.total)} closeModal={closeModal} />
<PaymentInformationModal
token={token}
orderTotal={formatCurrency(summary.total)}
closeModal={closeModal}
/>
) : (
<TempUser isOpen={modalOpen} onClose={closeModal} />
)}
Expand Down

0 comments on commit f8f5537

Please sign in to comment.