Skip to content
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

Feature/merges #30

Merged
merged 36 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
01a3f69
Add Header
hamidazim321 Jul 31, 2023
c02c492
Update with footer
mershark Jul 31, 2023
0ac0109
Create display list
mershark Jul 31, 2023
bc27793
Update with style
mershark Jul 31, 2023
9674491
Correct lint error
mershark Jul 31, 2023
929bc46
Fix Linter Errors
hamidazim321 Jul 31, 2023
16ecbcb
Fix Eslint errors
hamidazim321 Jul 31, 2023
b39fc43
Merge pull request #22 from mershark/feature/display-meal
mershark Jul 31, 2023
18d20e0
add function to post and get comments from the api
hamidazim321 Jul 31, 2023
bff2a9a
Add function to create and populate popups
hamidazim321 Jul 31, 2023
74d36b6
add function to post comments
hamidazim321 Jul 31, 2023
db83f68
add comments counter
hamidazim321 Jul 31, 2023
c2a4e59
Fix eslint errors
hamidazim321 Jul 31, 2023
3c2e165
Fix Stylelint errors
hamidazim321 Jul 31, 2023
62ce965
Relocate the footer to the bottom of the page
hamidazim321 Jul 31, 2023
1c747f4
Merge pull request #23 from mershark/feature/comments
hamidazim321 Jul 31, 2023
77b4b21
Update with add function to display likes
mershark Jul 31, 2023
acdcb12
Fix linter errors
hamidazim321 Jul 31, 2023
d8eeece
Merge pull request #24 from mershark/features/like
mershark Jul 31, 2023
8ae53f7
add jsdom
hamidazim321 Jul 31, 2023
0ec6303
Add tests for the comments Counter Function
hamidazim321 Aug 1, 2023
9767259
Fix Linter errors
hamidazim321 Aug 1, 2023
ea994af
Merge pull request #27 from mershark/feature/test1
hamidazim321 Aug 1, 2023
2acd8ba
Create test2
mershark Aug 1, 2023
a743e2d
Fix Linter Errors
hamidazim321 Aug 1, 2023
7405266
Merge pull request #28 from mershark/feature/test2
mershark Aug 1, 2023
326c21a
Add final styles
hamidazim321 Aug 1, 2023
562c369
Fix Linter errors
hamidazim321 Aug 1, 2023
222803c
Merge pull request #29 from mershark/feature/finalTouches
hamidazim321 Aug 1, 2023
ce04b2e
Update README.md
mershark Aug 1, 2023
7e53e9c
Create MIT.md
mershark Aug 1, 2023
949a11a
Update the dist folder
hamidazim321 Aug 1, 2023
91703f6
Merge branch 'feature/merges' of github.com:mershark/Microverse-capst…
hamidazim321 Aug 1, 2023
72afdc5
Relocate the Counter functions into separate modules aand update the …
hamidazim321 Aug 1, 2023
869a987
Update Imports
hamidazim321 Aug 1, 2023
001b421
Update dist folder and fix linter errors
hamidazim321 Aug 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix Linter Errors
  • Loading branch information
hamidazim321 committed Jul 31, 2023
commit 929bc4604bdd51e40ef909e0e090e84897013434
1,822 changes: 1,807 additions & 15 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
"eslint-plugin-import": "^2.28.0",
"html-webpack-plugin": "^5.5.3",
"style-loader": "^3.3.3",
"stylelint": "^13.13.1",
"stylelint-config-standard": "^21.0.0",
"stylelint-csstree-validator": "^1.9.0",
"stylelint-scss": "^3.21.0",
"webpack": "^5.4.0",
"webpack-cli": "^4.2.0",
"webpack-dev-server": "^4.15.1"
Expand Down
2 changes: 1 addition & 1 deletion src/Modules/Images.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import logo from '../assets/brand-logo.png';
const Navbar = () => {
const img = document.querySelector('#logo');
img.src = logo;
}
};

export default Navbar;
9 changes: 4 additions & 5 deletions src/Modules/counter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint-disable linebreak-style */
const mealCounter = (arr) => {
const nav_dishes = document.querySelector('#nav-dishes');
nav_dishes.textContent += ` (${arr.length})`;
}
export { mealCounter };
const navDishes = document.querySelector('#nav-dishes');
navDishes.textContent += ` (${arr.length})`;
};
export default mealCounter;
50 changes: 23 additions & 27 deletions src/Modules/displayMeals.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import getMealList from "./getMeals"
import { mealCounter } from "./counter"
import getMealList from './getMeals.js';
import mealCounter from './counter.js';

const MEAL_TEMPLATE = `
<div class="meal-thumbnail">
Expand All @@ -12,34 +12,30 @@ const MEAL_TEMPLATE = `
</div>
<span class="like-count"></span>
<button class="meal-comment">Comments</button>
</div>`
</div>`;

/* eslint-disable linebreak-style */
const displayMeal = async ()=> {
const meals = await getMealList()
const Container = document.querySelector('#meals')
meals.forEach(meal => {
const card = document.createElement('div')
card.innerHTML = MEAL_TEMPLATE
const thumbnail = card.querySelector('.meal-thumbnail img')
const dish = card.querySelector('.meal-name')
const likes = card.querySelector('.like-count')
const likeButton = card.querySelector('.likeButton')
const displayMeal = async () => {
const meals = await getMealList();
const Container = document.querySelector('#meals');
meals.forEach((meal) => {
const card = document.createElement('div');
card.innerHTML = MEAL_TEMPLATE;
const thumbnail = card.querySelector('.meal-thumbnail img');
const dish = card.querySelector('.meal-name');
const likes = card.querySelector('.like-count');
const likeButton = card.querySelector('.likeButton');

dish.textContent = meal.strMeal
thumbnail.src = meal.strMealThumb
likes.textContent = '0 Likes'
dish.textContent = meal.strMeal;
thumbnail.src = meal.strMealThumb;
likes.textContent = '0 Likes';

likeButton.addEventListener('click', ()=> {
handleLikeEvent(card.id)
})
card.classList.add('meal-card');
card.id = meal.idMeal;

card.classList.add('meal-card')
card.id = meal.idMeal
Container.appendChild(card);
});
await mealCounter(meals);
};

Container.appendChild(card)
})
await mealCounter(meals)
}

export default displayMeal
export default displayMeal;
12 changes: 6 additions & 6 deletions src/Modules/getMeals.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* eslint-disable linebreak-style */
import { MEAL_DB_URL } from "./API-Data";
import { MEAL_DB_URL } from './API-Data.js';

const getMealList = async () => {
const request = await fetch(MEAL_DB_URL)
const {meals} = await request.json()
return meals
}
const request = await fetch(MEAL_DB_URL);
const { meals } = await request.json();
return meals;
};

export default getMealList
export default getMealList;
9 changes: 4 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import _ from 'lodash';
import './style.css';
import Navbar from './Modules/Images';
import displayMeal from './Modules/displayMeals'
import Navbar from './Modules/Images.js';
import displayMeal from './Modules/displayMeals.js';

Navbar()
displayMeal()
Navbar();
displayMeal();
2 changes: 1 addition & 1 deletion src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ footer p {
justify-content: center;
}

.meal-thumbnail,
.meal-thumbnail,
.meal-thumbnail img {
width: 100%;
}
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'dist'),
clean: true
clean: true,
},
mode: 'development',
devtool: 'inline-source-map',
Expand Down