-
Notifications
You must be signed in to change notification settings - Fork 534
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d170e7e
commit c376bd0
Showing
10 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import React, { useState } from 'react'; | ||
import styles from './style.module.css'; | ||
|
||
const ImageGallery: React.FC = () => { | ||
const [selectedImage, setSelectedImage] = useState<string | null>(null); | ||
|
||
const images: string[] = [ | ||
'https://imgs.search.brave.com/bAdI7a7qnuuOIJphttt3DfbzLnCU7ZDMtnkejXq6UII/rs:fit:500:0:0/g:ce/aHR0cHM6Ly9zdDIu/ZGVwb3NpdHBob3Rv/cy5jb20vMTAwMDkz/OC81NDk5L2kvNDUw/L2RlcG9zaXRwaG90/b3NfNTQ5OTg2MTMt/c3RvY2stcGhvdG8t/Z2luZ2VyLWNhdC5q/cGc', | ||
'https://imgs.search.brave.com/YzG9FgYN5qLWsiYyJ4dUEvxav9e98dBH0loR8YPRA1E/rs:fit:500:0:0/g:ce/aHR0cHM6Ly9tZWRp/YS5pc3RvY2twaG90/by5jb20vaWQvMTc0/ODc3NTY1L3Bob3Rv/L3BvcnRyYWl0LW9m/LWEtYnJvd24tY2F0/LWFnYWluc3QtYS1n/cmF5LWJhY2tncm91/bmQuanBnP3M9NjEy/eDYxMiZ3PTAmaz0y/MCZjPWlGcFFNSzlF/aTIzVm9XcExLa2Zh/TFVtdXN5Y3VaWllV/OWtWMjNzT2F6YzQ9', | ||
'https://imgs.search.brave.com/lZtf1S7JKFcaZs2lhxTpAtaJzTk_V35Xt8ys4htuVBU/rs:fit:500:0:0/g:ce/aHR0cHM6Ly9idXJz/dC5zaG9waWZ5Y2Ru/LmNvbS9waG90b3Mv/Y2F0LXBvc2VzLXBl/cmZlY3RseS5qcGc_/d2lkdGg9MTAwMCZm/b3JtYXQ9cGpwZyZl/eGlmPTAmaXB0Yz0w', | ||
'https://imgs.search.brave.com/t6Nv0DwxoIACRxxtX2h7yt31ux5SCXHWgHVpoGh1diw/rs:fit:500:0:0/g:ce/aHR0cHM6Ly90My5m/dGNkbi5uZXQvanBn/LzAyLzM2Lzk5LzIy/LzM2MF9GXzIzNjk5/MjI4M19zTk94Q1ZR/ZUZMZDVwZHFhS0do/OERSR01aeTdQNFhL/bS5qcGc', | ||
]; | ||
|
||
const handleClick = (image: string) => { | ||
setSelectedImage(image); | ||
}; | ||
|
||
return ( | ||
<div className={styles['image-gallery-container']}> | ||
<h1 className={styles['gallery-heading']}>Image Gallery 🐱</h1> | ||
<p className={styles['gallery-para']}>Click on an image!</p> | ||
<div className={styles['image-container']}> | ||
{images.map((image, index) => ( | ||
<div key={index} className={styles['image-wrapper']} onClick={() => handleClick(image)}> | ||
<img src={image} alt={`Image ${index + 1}`} className={styles['gallery-image']} /> | ||
</div> | ||
))} | ||
</div> | ||
{selectedImage && ( | ||
<div className={styles['selected-image']}> | ||
<h2 className={styles['selected-heading']}>Selected Image</h2> | ||
<img src={selectedImage} alt="Selected" className={styles['selected-img']} /> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default ImageGallery; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* Styles for the Image Gallery */ | ||
.image-gallery-container { | ||
text-align: center; | ||
margin: 20px; | ||
} | ||
|
||
.gallery-heading { | ||
font-size: 24px; | ||
margin-bottom: 20px; | ||
} | ||
|
||
.gallery-para { | ||
text-decoration: underline; | ||
} | ||
|
||
.image-container { | ||
display: flex; | ||
flex-wrap: wrap; | ||
justify-content: center; | ||
gap: 20px; | ||
} | ||
|
||
.image-wrapper { | ||
cursor: pointer; | ||
transition: transform 0.2s ease-in-out; | ||
} | ||
|
||
.image-wrapper:hover { | ||
transform: scale(1.1); | ||
} | ||
|
||
.gallery-image { | ||
width: 200px; | ||
height: 200px; | ||
object-fit: cover; | ||
border-radius: 10px; | ||
box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.3); | ||
} | ||
|
||
/* Styles for the Selected Image */ | ||
.selected-image { | ||
margin-top: 40px; | ||
text-align: center; | ||
} | ||
|
||
.selected-heading { | ||
font-size: 20px; | ||
margin-bottom: 10px; | ||
} | ||
|
||
.selected-img { | ||
max-width: 100%; | ||
border-radius: 10px; | ||
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters