// components/StatsComponent.js

import { escapeHtml }
    from '../utils/escapeHtml.js';

export class StatsComponent {

    static render(section, data) {

        const html = section.fields.map(field => {

            return `
                <div class="stat">

                    <span>
                        ${escapeHtml(field)}
                    </span>

                    <strong>
                        ${escapeHtml(data[field])}
                    </strong>

                </div>
            `;

        }).join('');

        return `
            <div class="project-stats">
                ${html}
            </div>
        `;
    }
}
