// PageNavigation.js - Reusable page navigation component // Creates the "On this page" / breadcrumb navigation card /** * Renders a page navigation card * @param {string} label - Label for the navigation (e.g., "On this page:", "Area Name:") * @param {Array} items - Array of navigation items: { text, href, active } * @returns {string} HTML string for the navigation card */ export function renderPageNavigation(label, items) { if (!items || items.length === 0) { return ''; } return ` `; } /** * Convenience function for home page navigation */ export function renderHomeNavigation() { return renderPageNavigation('On this page:', [ { text: 'About', href: '/#about' }, { text: 'Recent Works', href: '/#recent-works' }, { text: 'Research Areas', href: '/#research-areas' }, { text: 'Team Members', href: '/#team' } ]); } /** * Convenience function for area page navigation * @param {string} areaId - Area identifier * @param {string} areaTitle - Area display title * @param {Array} topics - Array of topics: { id, navName } * @param {string} currentTopicId - Current topic ID (if any) */ export function renderAreaNavigation(areaId, areaTitle, topics, currentTopicId = null) { const items = [ { text: 'Overview', href: `/${areaId}#overview`, active: currentTopicId === null || currentTopicId === 'overview' }, ...topics.map(topic => ({ text: topic.navName, href: `/${areaId}#${topic.id}`, active: topic.id === currentTopicId })) ]; return renderPageNavigation(`${areaTitle}:`, items); }