Skip to content

Commit 8bbb28e

Browse files
committed
Protection
1 parent de93c3e commit 8bbb28e

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

Frontend/src/components/CardProduit/CardProduit.js

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, {useState} from 'react';
22
import { Link } from 'react-router-dom';
33
import { BiCartAdd } from 'react-icons/bi';
44
import { AiOutlineHeart } from 'react-icons/ai';
@@ -13,6 +13,8 @@ const CardProduit = ({ data }) => {
1313
Dispatch(addToPanier(item_data));
1414
};
1515

16+
const [detail, setDetail] = useState(false);
17+
1618
return (
1719
<div>
1820
<div className="max-w-sm bg-white px-6 pt-6 pb-2 rounded-xl shadow-lg transform hover:scale-105 transition duration-500">
@@ -29,15 +31,24 @@ const CardProduit = ({ data }) => {
2931
<div className="flex space-x-1 items-center">
3032
<p>Prix: {data.prix} Ar</p>
3133
</div>
34+
<br/>
35+
{ detail &&
3236
<div className="flex space-x-1 items-center">
33-
<p>Details: {data.description} Ar</p>
37+
<p>Details: <br/> {data.description}</p>
3438
</div>
39+
}
3540
<button
3641
className="mt-4 w-full text-white bg-blue-600 hover:bg-blue-400 py-2 rounded-xl shadow-lg"
3742
onClick={() => handleToPanier(data)}
3843
>
3944
Ajouter au panier
4045
</button>
46+
<button
47+
className="mt-4 w-full text-white bg-gray-600 hover:bg-gray-400 py-2 rounded-xl shadow-lg"
48+
onClick={() => setDetail(!detail)}
49+
>
50+
{detail?'Réduire':'Voir details'}
51+
</button>
4152
</div>
4253
</div>
4354
</div>

Frontend/src/components/CardProduitAdmin/Cardcrud.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ const Cardcrud = () => {
136136
</label>
137137
<label className="flex flex-col">
138138
Description:
139-
<input
139+
<textarea
140140
type="text"
141141
name="description"
142142
value={formValues.description}

0 commit comments

Comments
 (0)