Select Git revision
Forked from an inaccessible project.
-
Thomas Fritsch authoredThomas Fritsch authored
main.js 1000 B
const data = [
{
nom: 'Regina',
base: 'tomate',
prix_petite: 6.5,
prix_grande: 9.95,
image: 'https://images.unsplash.com/photo-1532246420286-127bcd803104?fit=crop&w=500&h=300'
},
{
nom: 'Napolitaine',
base: 'tomate',
prix_petite: 6.5,
prix_grande: 8.95,
image: 'https://images.unsplash.com/photo-1562707666-0ef112b353e0?&fit=crop&w=500&h=300'
},
{
nom: 'Spicy',
base: 'crème',
prix_petite: 5.5,
prix_grande: 8,
image: 'https://images.unsplash.com/photo-1458642849426-cfb724f15ef7?fit=crop&w=500&h=300'
}
];
class Component {
tag;
children;
constructor( tag, children ){
this.tag = tag;
this.children = children;
}
render() {
return `<${this.tag} ${
this.children ?
`>${this.children}</${this.tag}>` :
' />'
}`;
}
}
const title = new Component( 'h1', 'La carte' );
document.querySelector('.pageTitle').innerHTML = title.render();
const img = new Component( 'img' );
document.querySelector( '.pizzasContainer' ).innerHTML = img.render();