Skip to content
Snippets Groups Projects
Commit dd0fc947 authored by Adrien Lazaro's avatar Adrien Lazaro
Browse files

TP1 fini

parent 8cd29c1a
No related branches found
No related tags found
No related merge requests found
{
"presets": ["@babel/env"]
}
\ No newline at end of file
"use strict";
/*console.log('Welcome to ', {title:'PizzaLand', emoji: '🍕'});
console.log(42+"12"-10);
let what = 'door';
console.log('Hold','the',what);*/
var name = "Regina"; //const data = [`Regina`,`Napolitaine`,`Spicy`];
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 url = "images/".concat(name.toLowerCase(), ".jpg");
var html = "";
console.log(url);
data.forEach(function (element) {
var url2 = "".concat(element.image);
html = "".concat(html, "\n<article class=\"pizzaThumbnail\">\n<a href=\"").concat(url2, "\">\n<img src=\"").concat(url2, "\"/>\n<section>\n<h4>").concat(element.name, "</h4>\n<ul>\n<li>Prix petit format : ").concat(element.price_small, "\u20AC</li>\n<li>Prix grand format : ").concat(element.price_large, "\u20AC</li>\n</ul>\n</section>\n</a>\n</article>");
document.querySelector('.pageContent').innerHTML = html;
});
console.log(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="src/main.js" defer></script>
</head> </head>
<body> <body>
<header> <header>
......
Source diff could not be displayed: it is too large. Options to address this: view the blob.
{
"name": "pizzaland",
"version": "1.0.0",
"description": "une pizzeria",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git@gitlab-ssh.univ-lille.fr:adrien.lazaro.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 🍕 !'); /*console.log('Welcome to ', {title:'PizzaLand', emoji: '🍕'});
\ No newline at end of file console.log(42+"12"-10);
let what = 'door';
console.log('Hold','the',what);*/
let name = `Regina`;
//const data = [`Regina`,`Napolitaine`,`Spicy`];
let 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',
}
]
/*
data.sort(function (a,b){
return a.name.localeCompare(b.name);
});
*/
/*
data.sort(function (a,b){
return a.price_small-b.price_small;
})*/
/*
data.sort(function (a,b){
if(a.price_small-b.price_small != 0){
return a.price_small-b.price_small;
}else{
return a.price_large-b.price_large;
}
})
*/
//data = data.filter(pizza => pizza.base.localeCompare("tomate")==0);
//data = data.filter(pizza => pizza.price_small<6);
//let RegEx = /.*i.*i.*/
//data = data.filter(pizza => pizza.name.match(RegEx))
const url = `images/${name.toLowerCase()}.jpg`;
let html = ``;
console.log(url);
data.forEach(({name, image, price_small, price_large}) => {
const url2 = `${image}`;
html = `${html}
<article class="pizzaThumbnail">
<a href="${url2}">
<img src="${url2}"/>
<section>
<h4>${name}</h4>
<ul>
<li>Prix petit format : ${price_small}€</li>
<li>Prix grand format : ${price_large}€</li>
</ul>
</section>
</a>
</article>`;
document.querySelector('.pageContent').innerHTML = html;
});
console.log(html);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment