j'aimerais pouvoir cliquer sur la photo du postit final pour l'agrandir et un petit pour la refermer une fois agrandit - Follow Up Deployment
Browse files- index.html +26 -2
index.html
CHANGED
|
@@ -322,6 +322,7 @@
|
|
| 322 |
const PostIt = ({ ad, onLike, onAddComment, isLoggedIn }) => {
|
| 323 |
const [showComments, setShowComments] = useState(false);
|
| 324 |
const [newComment, setNewComment] = useState("");
|
|
|
|
| 325 |
|
| 326 |
const bgColors = {
|
| 327 |
yellow: "bg-yellow-200",
|
|
@@ -335,14 +336,37 @@
|
|
| 335 |
<div className="pin"></div>
|
| 336 |
<h3 className="font-bold text-lg mb-2">{ad.title}</h3>
|
| 337 |
{ad.photo && (
|
| 338 |
-
<div className="mb-3">
|
| 339 |
<img
|
| 340 |
src={ad.photo}
|
| 341 |
alt={ad.title}
|
| 342 |
-
className="w-full h-40 object-cover rounded"
|
| 343 |
/>
|
| 344 |
</div>
|
| 345 |
)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 346 |
<p className="mb-3">{ad.description}</p>
|
| 347 |
<div className="flex justify-between items-center mb-2">
|
| 348 |
<div className="text-sm text-gray-700">
|
|
|
|
| 322 |
const PostIt = ({ ad, onLike, onAddComment, isLoggedIn }) => {
|
| 323 |
const [showComments, setShowComments] = useState(false);
|
| 324 |
const [newComment, setNewComment] = useState("");
|
| 325 |
+
const [showPhotoModal, setShowPhotoModal] = useState(false);
|
| 326 |
|
| 327 |
const bgColors = {
|
| 328 |
yellow: "bg-yellow-200",
|
|
|
|
| 336 |
<div className="pin"></div>
|
| 337 |
<h3 className="font-bold text-lg mb-2">{ad.title}</h3>
|
| 338 |
{ad.photo && (
|
| 339 |
+
<div className="mb-3 cursor-pointer" onClick={() => setShowPhotoModal(true)}>
|
| 340 |
<img
|
| 341 |
src={ad.photo}
|
| 342 |
alt={ad.title}
|
| 343 |
+
className="w-full h-40 object-cover rounded hover:opacity-90 transition-opacity"
|
| 344 |
/>
|
| 345 |
</div>
|
| 346 |
)}
|
| 347 |
+
|
| 348 |
+
{showPhotoModal && (
|
| 349 |
+
<div className="fixed inset-0 bg-black bg-opacity-90 flex items-center justify-center z-50 p-4" onClick={() => setShowPhotoModal(false)}>
|
| 350 |
+
<div className="relative max-w-full max-h-full">
|
| 351 |
+
<img
|
| 352 |
+
src={ad.photo}
|
| 353 |
+
alt={ad.title}
|
| 354 |
+
className="max-w-full max-h-[90vh] object-contain"
|
| 355 |
+
/>
|
| 356 |
+
<button
|
| 357 |
+
className="absolute top-4 right-4 bg-black bg-opacity-50 text-white p-2 rounded-full hover:bg-opacity-70"
|
| 358 |
+
onClick={(e) => {
|
| 359 |
+
e.stopPropagation();
|
| 360 |
+
setShowPhotoModal(false);
|
| 361 |
+
}}
|
| 362 |
+
>
|
| 363 |
+
<svg xmlns="http://www.w3.org/2000/svg" className="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 364 |
+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />
|
| 365 |
+
</svg>
|
| 366 |
+
</button>
|
| 367 |
+
</div>
|
| 368 |
+
</div>
|
| 369 |
+
)}
|
| 370 |
<p className="mb-3">{ad.description}</p>
|
| 371 |
<div className="flex justify-between items-center mb-2">
|
| 372 |
<div className="text-sm text-gray-700">
|