quotes

My favourite quotes. (gatsbyjs)
git clone http://git.hanabi.in/repos/quotes.git
Log | Files | Refs | README | LICENSE

header.js (1618B)


      1 /* eslint-disable eqeqeq */
      2 
      3 import { Link } from 'gatsby';
      4 import PropTypes from 'prop-types';
      5 import React from 'react';
      6 import { siteMetadata } from '../../gatsby-config';
      7 
      8 const { repo } = siteMetadata;
      9 function Header({
     10   description,
     11   link = `/${repo}`,
     12   showHeader,
     13   siteTitle,
     14   slug,
     15 }) {
     16   return (
     17     <header id="header" className="header-container">
     18       <div className="header site-header">
     19         <nav
     20           id="main-menu"
     21           className="main-menu-container"
     22           aria-label="Main Menu"
     23         >
     24           <ul className="main-menu">
     25             <li>
     26               {slug == 'quote' ? (
     27                 <BoldEntry text="Quotes" />
     28               ) : (
     29                 <Link to={`/${repo}`}>Quotes</Link>
     30               )}
     31             </li>
     32             <li>
     33               {slug == 'about' ? (
     34                 <BoldEntry text="About" />
     35               ) : (
     36                 <Link to={`/${repo}/about`}>About</Link>
     37               )}
     38             </li>
     39           </ul>
     40         </nav>
     41 
     42         {showHeader && (
     43           <div className="header-info">
     44             <p className="site-title title">
     45               <Link to={link}>{siteTitle}</Link>
     46             </p>
     47             {siteTitle == 'Quotes' && (
     48               <p className="site-description subtitle">{description}</p>
     49             )}
     50           </div>
     51         )}
     52       </div>
     53     </header>
     54   );
     55 }
     56 
     57 Header.propTypes = {
     58   siteTitle: PropTypes.string,
     59 };
     60 
     61 Header.defaultProps = {
     62   siteTitle: '',
     63 };
     64 
     65 function BoldEntry({ text = '' }) {
     66   return <span style={{ fontWeight: 700, cursor: 'default' }}>{text}</span>;
     67 }
     68 
     69 export default Header;