-
Notifications
You must be signed in to change notification settings - Fork 0
Think you can decode this ? ;) #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: review
Are you sure you want to change the base?
Conversation
Added relative position to the image-container Created image-coverlay using JS Added base.css to float.html Added Overlay info, made some design changes to the overlay - Renamed location to src containing the image path - Added new fields for the UI - Created overlay-content div - Added the style for the same Added Overlay interaction to flex.html Parsing the Date
* Populatin a basic sort filter in DOM via JS * Data correction in images.json * - Implemented Sorting functionaltiy: -- Created generateImagesData() -- Created rebuildGallery() -- Created sortGallery() -- Added check to identify if the gallery is being built post sorting * - Implemented Filtering functionality -- Created filterGallery() -- Updated buildFilters() * Sorting and Filtering now work in co-relation to each other - Changed sort and filter function to Pure functions - Improved rebuild function logic
<link rel="stylesheet" href="src/css/modal.css"> | ||
</head> | ||
<body> | ||
<div id='gallery-app'> |
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.
Keep only one type of quote for the attributes, single or double, do not mix them
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.
Done
@@ -0,0 +1,43 @@ | |||
#gallery-app{ | |||
} |
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.
Always remove unwanted code
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.
done
.images{ | ||
width: 100%; | ||
display: flex; | ||
flex-direction: row; |
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.
Avoid adding default properties
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.
Default properties as in width: 100%
?
font-size: 18px; | ||
} | ||
|
||
#gallery-examples{ |
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.
Why this style is here? shouldn't it be in base.css?
and never add styling on id,
Read more on css specificity: https://medium.com/@emmabostian/css-specificity-d5fdb0996c81
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.
It is here because, it is the styling to the different Gallery examples index file
var currentModalIndex = 0; | ||
|
||
function generateImagesData(imagesInput){ | ||
var images = imagesInput; |
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.
Is this function needed?
var newSrc = ''; | ||
|
||
var newIndex = parseInt(currentModalIndex)+ parseInt(type); | ||
if ( type == 1){ |
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.
always avoid ==
crossButton.setAttribute('id', 'close-modal'); | ||
crossButton.setAttribute('class', 'close-modal'); | ||
crossButton.innerHTML = '✕'; | ||
crossButton.addEventListener("click", closeModal) |
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.
You can read on what's the 3rd argument of addEventListener and what's the use case, will be fun
var pTag = document.createElement('p'); | ||
|
||
if (type === 'sort') { | ||
pTag.innerText = ('Sort By:'); |
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.
Why in brackets?
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.
Done
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.
Start using ES6.
@@ -0,0 +1,16 @@ | |||
<!DOCTYPE html> |
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.
Suggestion: Single index.html would have sufficed.
} | ||
|
||
.gallery{ | ||
width: 50%; |
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.
Why do we need this width to be 50%?
It looks odd on big screens.
@@ -0,0 +1,43 @@ | |||
#gallery-app{ |
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.
Remove if not being used.
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.
done
.modal-previous-button, | ||
.modal-next-button{ | ||
position: absolute; | ||
top: 40%; |
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.
A better calculation would be calc(100% - (paddingTop + paddingBottom))
height: 50%; | ||
position: absolute; | ||
bottom: 0; | ||
background-color: red; |
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.
colors could have been separated.
var currentFilterValue = "Category 1"; | ||
var currentModalIndex = 0; | ||
|
||
function generateImagesData(imagesInput){ |
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.
What is the purpose of this function?
for (var image in imagesData){ | ||
var currentImage = imagesData[image]; | ||
var imageSrc = currentImage["src"]; | ||
var imageTitle = currentImage["title"]; |
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.
This is not being used anywhere.
return images; | ||
} | ||
|
||
function rebuildGallery(inputImageArray){ |
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.
Instead of building gallery every time, we can show/hide the sorted elements from the list.
|
||
var len = inputImageArray.length; | ||
|
||
for (var val=0; val < len; val++){ |
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.
Can use filter() instead
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.
filter is generally used in cases we want to filter out the elements based on certain conditions, here I'm just sorting the arrays...
|
||
.gallery{ | ||
width: 50%; | ||
margin: auto; |
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.
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.
The restriction here was to implement the solution using three different approaches separately:
- float
- grid
- flex
No description provided.