Skip to content

Conversation

caffeinatedHuman
Copy link
Owner

No description provided.

caffeinatedHuman and others added 17 commits April 26, 2020 17:43
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'>

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

Copy link
Owner Author

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{
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always remove unwanted code

Copy link
Owner Author

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;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid adding default properties

Copy link
Owner Author

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{

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

Copy link
Owner Author

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;

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){

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 = '&#10005;';
crossButton.addEventListener("click", closeModal)

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:');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why in brackets?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link

@Ayushi-Sharma Ayushi-Sharma left a 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>

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%;

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{

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.

Copy link
Owner Author

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%;

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;

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){

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"];

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){

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++){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can use filter() instead

Copy link
Owner Author

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;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Owner Author

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:

  1. float
  2. grid
  3. flex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants