header.js (1405B)
1 import React from 'react'; 2 import { Link } from 'react-router-dom'; 3 4 function Header() { 5 const basePath = process.env.PUBLIC_URL; 6 return ( 7 <nav className="navbar navbar-expand-lg navbar-dark bg-danger mb-4"> 8 <Link className="navbar-brand" to={`${basePath}/`}> 9 <span role="img" aria-label="time convertor"> 10 {new Date().getSeconds() % 2 ? '⏳' : '⌛️'} 11 </span>{' '} 12 time convertor 13 </Link> 14 <button 15 className="navbar-toggler" 16 type="button" 17 data-toggle="collapse" 18 data-target="#navbarNav" 19 aria-controls="navbarNav" 20 aria-expanded="false" 21 aria-label="Toggle navigation" 22 > 23 <span className="navbar-toggler-icon"></span> 24 </button> 25 <div className="collapse navbar-collapse" id="navbarNav"> 26 <ul className="navbar-nav"> 27 <li className="nav-item"> 28 <Link className="nav-link" to={`${basePath}/help`}> 29 Help 30 </Link> 31 </li> 32 <li className="nav-item"> 33 <Link className="nav-link" to={`${basePath}/future`}> 34 Future 35 </Link> 36 </li> 37 <li className="nav-item"> 38 <Link className="nav-link" to={`${basePath}/from-to`}> 39 From-to 40 </Link> 41 </li> 42 </ul> 43 </div> 44 </nav> 45 ); 46 } 47 48 export default Header;