@@ -19,6 +19,7 @@ function SelectCredentials({ showPopup, setShowPopup, setSelectionMap, conforman
19
19
const [ showRequestedFields , setShowRequestedFields ] = useState ( false ) ;
20
20
const [ renderContent , setRenderContent ] = useState ( showRequestedFields ) ;
21
21
const [ applyTransition , setApplyTransition ] = useState ( false ) ;
22
+ const [ credentialDisplay , setCredentialDisplay ] = useState ( { } ) ;
22
23
23
24
useEffect ( ( ) => {
24
25
const getData = async ( ) => {
@@ -81,6 +82,13 @@ function SelectCredentials({ showPopup, setShowPopup, setSelectionMap, conforman
81
82
return null ;
82
83
} ;
83
84
85
+ const toggleCredentialDisplay = ( identifier ) => {
86
+ setCredentialDisplay ( prev => ( {
87
+ ...prev ,
88
+ [ identifier ] : ! prev [ identifier ]
89
+ } ) ) ;
90
+ } ;
91
+
84
92
return (
85
93
< div className = "fixed inset-0 flex items-center justify-center z-50" >
86
94
< div className = "absolute inset-0 bg-black opacity-50" > </ div >
@@ -130,18 +138,25 @@ function SelectCredentials({ showPopup, setShowPopup, setSelectionMap, conforman
130
138
131
139
< div className = 'flex flex-wrap justify-center flex overflow-y-auto max-h-[40vh]' >
132
140
{ images . map ( image => (
133
- < div className = "m-3 flex justify-center" >
134
- < div className = 'w-1/2' >
135
- < div className = "relative rounded-xl w-full overflow-hidden transition-shadow shadow-md hover:shadow-lg cursor-pointer" >
141
+ < >
142
+ < div key = { image . credentialIdentifier } className = "m-3 flex flex-col items-center" >
143
+ < div className = "relative rounded-xl w-2/3 overflow-hidden transition-shadow shadow-md hover:shadow-lg cursor-pointer" >
136
144
< CredentialImage key = { image . credentialIdentifier } credential = { image . credential } onClick = { ( ) => handleClick ( image . credentialIdentifier ) } className = { "w-full object-cover rounded-xl" } />
137
145
</ div >
146
+ < div className = 'w-2/3 mt-2' >
147
+ < button
148
+ onClick = { ( ) => toggleCredentialDisplay ( image . credentialIdentifier ) }
149
+ className = "text-xs py-2 w-full bg-custom-blue hover:bg-custom-blue-hover text-white font-medium rounded-lg" >
150
+ { credentialDisplay [ image . credentialIdentifier ] ? 'Hide Details' : 'Show Details' }
151
+ </ button >
152
+ < div
153
+ className = { `transition-all ease-in-out duration-500 overflow-hidden shadow-lg rounded-lg ${ credentialDisplay [ image . credentialIdentifier ] ? 'max-h-[500px] opacity-100' : 'max-h-0 opacity-0' } ` }
154
+ >
155
+ < CredentialInfo credential = { image . credential } mainClassName = { "text-xs w-full" } />
156
+ </ div >
157
+ </ div >
138
158
</ div >
139
- < div className = 'w-1/2' >
140
- < CredentialInfo credential = { image } />
141
- </ div >
142
-
143
-
144
- </ div >
159
+ </ >
145
160
) ) }
146
161
</ div >
147
162
< button
0 commit comments