Skip to content
Snippets Groups Projects
Select Git revision
  • e91cb793f6fdc8a994b9f1b603905e5ff8fb0f6f
  • master default protected
2 results

main.js

Blame
  • Forked from an inaccessible project.
    main.js 1.38 KiB
    const 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',
        }
    ];
    
    
    
    const html = data.filter(pizza => pizza.name.split("").filter(value => value === "i").length === 2).reduce((previous, current) => {
        return previous + `<article class="pizzaThumbnail">
                    <a href="${current.image}">
                        <img src="${current.image}" alt="${current.name}"/>
                        <section>
                            <h4>${current.name}</h4>
                            <ul>
                                <li>Prix petit format : ${current.price_small} €</li>
                                <li>Prix grand format : ${current.price_large} €</li>
                            </ul>
                        </section>
                    </a>
                </article>`;
    }, "");
    
    document.querySelector('.pageContent').innerHTML = html;