import React from 'react'; import { Link } from 'react-router-dom'; import '../css/navbar.css'; let pages = [ { url: '/', title: 'Home', }, { url: '#', title: 'About Us', items: [ { url: '/officers', title: 'Officers' }, { url: '/committee', title: 'Executive Committee' }, { url: '/class-council', title: 'Class Council' }, ], }, { url: '#', title: 'News', items: [ { url: '/news', title: 'News', }, { url: '/newsletter', title: 'Newsletter', }, ], }, { url: '/initiatives', title: 'Initiatives', }, { url: '#', title: 'What We Do', items: [ { url: '/mission', title: 'Mission and History', }, { url: 'https://docs.google.com/document/d/1ftcFGlGiyU4cS5zNX5KLoIm4M1TR90C7btj9nIWxp4M/edit', title: 'Constitution', }, { url: 'https://drive.google.com/open?id=0B7IEunr2_iS7MTcyMDA0NmQtOTFjYy00MWQ2LThiOTItNzg5NmJiZjgxMmIy', title: 'Meeting Minutes', }, { url: 'https://docs.google.com/spreadsheets/d/195ydC8ReqixYX989V_5FurQc5wdt_a7B29PtYzXyqJg/edit?usp=sharing', title: 'Finance', }, ], }, { url: '/involved', title: 'Get Involved', }, { url: '/feedback', title: 'Feedback', }, ]; export default function Navbar() { return (
TJ SGA {pages.map((page) => { if ('items' in page) { return (
{page.title}
{/* Most of these are external so we use tags instead of */} {page.items?.map((item) => { let isExternal = /https?:\/\//.test(item.url); if (isExternal) { // Treat external links differently; add 'target=_blank' so they // open in a new window return (
{item.title}
); } return (
{item.title}
); })}
); } else { return ( {page.title} ); } })}
); }