File tree 2 files changed +14
-3
lines changed
2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 1
- import React from 'react' ;
1
+ import React , { useState } from 'react' ;
2
2
import { Link } from 'react-router-dom' ;
3
3
import { BiCartAdd } from 'react-icons/bi' ;
4
4
import { AiOutlineHeart } from 'react-icons/ai' ;
@@ -13,6 +13,8 @@ const CardProduit = ({ data }) => {
13
13
Dispatch ( addToPanier ( item_data ) ) ;
14
14
} ;
15
15
16
+ const [ detail , setDetail ] = useState ( false ) ;
17
+
16
18
return (
17
19
< div >
18
20
< 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 }) => {
29
31
< div className = "flex space-x-1 items-center" >
30
32
< p > Prix: { data . prix } Ar</ p >
31
33
</ div >
34
+ < br />
35
+ { detail &&
32
36
< div className = "flex space-x-1 items-center" >
33
- < p > Details: { data . description } Ar </ p >
37
+ < p > Details: < br /> { data . description } </ p >
34
38
</ div >
39
+ }
35
40
< button
36
41
className = "mt-4 w-full text-white bg-blue-600 hover:bg-blue-400 py-2 rounded-xl shadow-lg"
37
42
onClick = { ( ) => handleToPanier ( data ) }
38
43
>
39
44
Ajouter au panier
40
45
</ 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 >
41
52
</ div >
42
53
</ div >
43
54
</ div >
Original file line number Diff line number Diff line change @@ -136,7 +136,7 @@ const Cardcrud = () => {
136
136
</ label >
137
137
< label className = "flex flex-col" >
138
138
Description:
139
- < input
139
+ < textarea
140
140
type = "text"
141
141
name = "description"
142
142
value = { formValues . description }
You can’t perform that action at this time.
0 commit comments