Skip to content
Snippets Groups Projects
Commit 2625384f authored by Thomas Fritsch's avatar Thomas Fritsch
Browse files

D.1. PizzaThumbnail

parent 0592230f
No related branches found
No related tags found
No related merge requests found
import Component from './Component.js';
import Img from './Img.js';
export default class PizzaThumbnail extends Component {
constructor({ nom, image, prix_petite, prix_grande }) {
super('article', { name: 'class', value: 'media' }, [
new Component('a', { name: 'href', value: image }, [
new Img(image),
new Component('section', { name: 'class', value: 'infos' }, [
new Component('h4', null, nom),
new Component('ul', null, [
new Component(
'li',
null,
`Prix petit format : ${prix_petite.toFixed(2)} €`
),
new Component(
'li',
null,
`Prix grand format : ${prix_grande.toFixed(2)} €`
),
]),
]),
]),
]);
}
}
import data from './data.js';
import Component from './components/Component.js';
import Img from './components/Img.js';
import PizzaThumbnail from './components/PizzaThumbnail.js';
const title = new Component('h1', null, ['La', ' ', 'carte']);
document.querySelector('.pageTitle').innerHTML = title.render();
const c = new Component('article', { name: 'class', value: 'media' }, [
new Img(
'https://images.unsplash.com/photo-1532246420286-127bcd803104?fit=crop&w=500&h=300'
),
'Regina',
]);
document.querySelector('.pizzasContainer').innerHTML = c.render();
const pt = new PizzaThumbnail(data[0]);
document.querySelector('.pizzasContainer').innerHTML = pt.render();
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment