-
-
Notifications
You must be signed in to change notification settings - Fork 806
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* create ImageCollector play * fix image aspect ratio * add cover image * fixes * remove comments Co-authored-by: Koustov <[email protected]> Co-authored-by: Murtuzaali Surti <[email protected]> Co-authored-by: Tapas Adhikary <[email protected]>
- Loading branch information
1 parent
bacf597
commit 5bd4f9b
Showing
4 changed files
with
124 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import PlayHeader from "common/playlists/PlayHeader"; | ||
import { useState } from "react"; | ||
import "./styles.css"; | ||
|
||
function ImageCollector(props) { | ||
const [urlInput, setUrlInput] = useState(""); | ||
const [images, setImages] = useState([]); | ||
|
||
function addImage() { | ||
setImages(images.concat(urlInput)); | ||
setUrlInput(""); | ||
} | ||
|
||
return ( | ||
<> | ||
<div className="play-details"> | ||
<PlayHeader play={props} /> | ||
<div className="play-details-body"> | ||
<div className="image-collector-container"> | ||
<div className="input-container"> | ||
<input | ||
className="input-url" | ||
type="url" | ||
placeholder="Enter image url" | ||
value={urlInput} | ||
onChange={(e) => setUrlInput(e.target.value)} | ||
/> | ||
<button className="input-button" type="submit" onClick={addImage}> | ||
Add | ||
</button> | ||
</div> | ||
|
||
<div className="image-grid"> | ||
{images.length > 0 ? ( | ||
images.map((image, index) => ( | ||
<div className="image-wrapper"> | ||
<img className="image" src={image} alt="grid" key={index} /> | ||
</div> | ||
)) | ||
) : ( | ||
<p className="empty-message"> | ||
Images will appear once you add them | ||
</p> | ||
)} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</> | ||
); | ||
} | ||
|
||
export default ImageCollector; |
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,19 @@ | ||
# Image Collector | ||
|
||
Users can collect images in a grid by submitting image URLs | ||
|
||
## Play Demographic | ||
|
||
- Language: js | ||
- Level: Beginner | ||
|
||
## Creator Information | ||
|
||
- User: AhnafAhamed | ||
- Gihub Link: https://github.com/AhnafAhamed | ||
- Blog: null | ||
- Video: null | ||
|
||
## Implementation Details | ||
|
||
This implementations adds images to your collection based on the url the user submits. |
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,52 @@ | ||
.input-container { | ||
width: max-content; | ||
margin: auto; | ||
} | ||
|
||
.input-url { | ||
padding: 8px 16px; | ||
width: 400px; | ||
margin-bottom: 32px; | ||
} | ||
|
||
.input-button { | ||
padding: 8px 16px; | ||
background-color: aqua; | ||
text-transform: uppercase; | ||
font-weight: 500; | ||
} | ||
|
||
.image-grid { | ||
max-width: 800px; | ||
margin: auto; | ||
display: flex; | ||
flex-wrap: wrap; | ||
justify-content: space-between; | ||
grid-gap: 12px; | ||
} | ||
.image-wrapper { | ||
width: 200px; | ||
height: 300px; | ||
flex-grow: 1; | ||
border: 1px solid #010326; | ||
} | ||
.image { | ||
width: 100%; | ||
height: 100%; | ||
object-fit: cover; | ||
} | ||
.empty-message { | ||
width: max-content; | ||
margin: auto; | ||
font-size: 24px; | ||
} | ||
|
||
@media (max-width: 400px) { | ||
.input-url { | ||
width: 240px; | ||
} | ||
|
||
.image-grid { | ||
justify-content: center; | ||
} | ||
} |
5bd4f9b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
react-play – ./
reactoplay.vercel.app
react-play-git-main-reactplayio.vercel.app
react-play-reactplayio.vercel.app