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

export function renderExternalLinks(links) {
  document.querySelectorAll('.external-link-strip').forEach(strip => {
    const pos = strip.dataset.position;
    const items = links.filter(l => l.position === pos);
    if (!items.length) {
      strip.style.display = 'none';
      return;
    }
    strip.innerHTML = items.map(l => `
      <a class="link-btn" href="${escapeHtml(l.url)}" target="_blank" rel="noopener">${escapeHtml(l.label)}</a>
    `).join('');
  });
}
