diff --git a/components/atoms/Card/Progress/index.js b/components/atoms/Card/Progress/index.js index c59e0b0..1c583a8 100644 --- a/components/atoms/Card/Progress/index.js +++ b/components/atoms/Card/Progress/index.js @@ -3,40 +3,36 @@ import { useEffect } from 'react'; import { AiOutlineArrowRight } from 'react-icons/ai'; import { HiOutlineArrowNarrowRight } from 'react-icons/hi'; -const CardProgress = ({ - title, - amount, - currency, - operations, - link, -}) => { +const CardProgress = ({ title, amount, currency, operations, link }) => { const somme = operations.reduce( (accumulateur, objet) => accumulateur + objet.amount, 0, ); const percent = (somme / amount) * 100; - useEffect(() => { }, [somme]); + useEffect(() => {}, [somme]); return (
50 && percent <= 75 + className={`${ + percent <= 50 + ? 'bg-[#F9F1FC]' + : percent > 50 && percent <= 75 ? 'bg-[rgba(255,69,0,0.2)]' : 'bg-[#E3F9E9]' - } py-4 px-4 flex justify-between items-center pr-10 rounded-lg cursor-pointer hover:shadow-sm`} + } py-4 px-4 flex justify-between items-center pr-10 rounded-lg cursor-pointer hover:shadow-sm`} >
50 && percent <= 75 + className={`radial-progress ${ + percent <= 50 + ? 'text-purple' + : percent > 50 && percent <= 75 ? 'text-[#FF4500]' : 'text-[#2ABB52]' - }`} + }`} style={{ '--value': percent, '--size': '4rem' }} > {percent.toFixed(0)}% @@ -55,12 +51,13 @@ const CardProgress = ({
50 && percent <= 75 + className={`shadow-xs hover:shadow-md p-2 border rounded-xl ${ + percent <= 50 + ? 'border-purple bg-purple' + : percent > 50 && percent <= 75 ? 'border-[#FF4500] bg-[#FF4500]' : 'border-[#2ABB52] bg-[#2ABB52]' - } opacity-80`} + } opacity-80`} >
diff --git a/tests/pages/saving/[slug].test.js b/tests/pages/saving/[slug].test.js index 4a7bfcd..72b5cb6 100644 --- a/tests/pages/saving/[slug].test.js +++ b/tests/pages/saving/[slug].test.js @@ -7,7 +7,7 @@ jest.mock('next/router', () => ({ useRouter: jest.fn().mockReturnValue({ query: { 'payment-intent': 'pi_1J4JrjGswQjYFZwX0Z1Z1Z1Z', - 'slug': 'test-slug', + slug: 'test-slug', }, }), })); @@ -17,7 +17,7 @@ describe('Saving', () => { const { container } = render( { } }} + value={{ transaction: {}, setTransaction: () => {} }} >