Skip to content
Snippets Groups Projects
Commit f3745b18 authored by Antoine Delaby's avatar Antoine Delaby
Browse files

Commiit du tp1

parent 096c4ded
Branches
No related tags found
No related merge requests found
{
"presets": ["@babel/env"]
}
\ No newline at end of file
"use strict";
var data = [{
name: 'Regina',
base: 'tomate',
price_small: 6.5,
price_large: 9.95,
image: 'https://images.unsplash.com/photo-1532246420286-127bcd803104?fit=crop&w=500&h=300'
}, {
name: 'Napolitaine',
base: 'tomate',
price_small: 6.5,
price_large: 8.95,
image: 'https://images.unsplash.com/photo-1562707666-0ef112b353e0?&fit=crop&w=500&h=300'
}, {
name: 'Spicy',
base: 'crème',
price_small: 5.5,
price_large: 8,
image: 'https://images.unsplash.com/photo-1458642849426-cfb724f15ef7?fit=crop&w=500&h=300'
}];
var html = ''; // data.sort(function compare(a, b) {
// if (a.name < b.name)
// return -1;
// if (a.name > b.name)
// return 1;
// return 0;
// });
// data.sort(function compare(a, b) {
// if (a.price_small < b.price_small)
// return -1;
// if (a.price_small > b.price_small)
// return 1;
// return 0;
// });
// data.sort(function compare(a, b) {
// if (a.price_small < b.price_small)
// return -1;
// if (a.price_small > b.price_small)
// return 1;
// if (a.price_small == b.price_small){
// if(a.price_large < b.price_large)
// return -1;
// if(a.price_large > b.price_large)
// return 1;
// }
// return 0;
// });
// const result = data.filter(data => data.base == 'tomate');
var result = data.filter(function (data) {
return data.price_small < 6;
});
for (var i = 0; i < result.length; i++) {
html += '<article class="pizzaThumbnail"><a href="' + result[i].image + '"><img src="' + result[i].image + '"/><section><h4>' + result[i].name + '</h4><ul><li>Prix petit format : ' + data[i].price_small + '€</li><li>Prix grand format : ' + data[i].price_large + '€</li></ul></section></a></article>';
}
document.querySelector('.pageContent').innerHTML = html;
\ No newline at end of file
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
<link rel="stylesheet" href="css/news.css"> <link rel="stylesheet" href="css/news.css">
<link rel="stylesheet" href="css/pizzaList.css"> <link rel="stylesheet" href="css/pizzaList.css">
<link rel="stylesheet" href="css/footer.css"> <link rel="stylesheet" href="css/footer.css">
<script src="build/main.js" defer></script>
</head> </head>
<body> <body>
<header> <header>
......
This diff is collapsed.
{
"name": "pizzaland",
"version": "1.0.0",
"description": "<img src=\"images/readme/header.jpg\">",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://gitlab.univ-lille.fr/antoine.delaby.etu/tp1.git"
},
"author": "",
"license": "ISC",
"devDependencies": {
"@babel/cli": "^7.12.10",
"@babel/core": "^7.12.10",
"@babel/preset-env": "^7.12.11"
}
}
console.log('Welcome to PizzaLand 🍕 !'); const data = [
\ No newline at end of file {
name: 'Regina',
base: 'tomate',
price_small: 6.5,
price_large: 9.95,
image: 'https://images.unsplash.com/photo-1532246420286-127bcd803104?fit=crop&w=500&h=300'
},
{
name: 'Napolitaine',
base: 'tomate',
price_small: 6.5,
price_large: 8.95,
image: 'https://images.unsplash.com/photo-1562707666-0ef112b353e0?&fit=crop&w=500&h=300'
},
{
name: 'Spicy',
base: 'crème',
price_small: 5.5,
price_large: 8,
image: 'https://images.unsplash.com/photo-1458642849426-cfb724f15ef7?fit=crop&w=500&h=300',
}
];
let html = '';
// data.sort(function compare(a, b) {
// if (a.name < b.name)
// return -1;
// if (a.name > b.name)
// return 1;
// return 0;
// });
// data.sort(function compare(a, b) {
// if (a.price_small < b.price_small)
// return -1;
// if (a.price_small > b.price_small)
// return 1;
// return 0;
// });
// data.sort(function compare(a, b) {
// if (a.price_small < b.price_small)
// return -1;
// if (a.price_small > b.price_small)
// return 1;
// if (a.price_small == b.price_small){
// if(a.price_large < b.price_large)
// return -1;
// if(a.price_large > b.price_large)
// return 1;
// }
// return 0;
// });
// const result = data.filter(data => data.base == 'tomate');
const result = data.filter(data => data.price_small < 6);
for(let i = 0; i < result.length; i++){
html += '<article class="pizzaThumbnail"><a href="' + result[i].image + '"><img src="' + result[i].image + '"/><section><h4>' + result[i].name +'</h4><ul><li>Prix petit format : ' + data[i].price_small + '€</li><li>Prix grand format : ' + data[i].price_large +'€</li></ul></section></a></article>';
}
document.querySelector('.pageContent').innerHTML = html;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment