All files / owid-grapher/site SiteHeader.tsx

100% Statements 80/80
100% Branches 1/1
100% Functions 1/1
100% Lines 80/80

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 1421x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x                                                                                                                            
import * as React from "react"
import { faSearch } from "@fortawesome/free-solid-svg-icons/faSearch"
import { faBars } from "@fortawesome/free-solid-svg-icons/faBars"
import { faEnvelopeOpenText } from "@fortawesome/free-solid-svg-icons/faEnvelopeOpenText"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
import { AlertBanner } from "./AlertBanner"
 
interface SiteHeaderProps {
    hideAlertBanner?: boolean
    baseUrl: string
}
 
export const SiteHeader = (props: SiteHeaderProps) => (
    <>
        <header className="site-header">
            <div className="wrapper site-navigation-bar">
                <div className="site-logo">
                    <a href="/">
                        Our World
                        <br /> in Data
                    </a>
                </div>
                <nav className="site-navigation">
                    <div className="topics-button-wrapper">
                        <a href="/#entries" className="topics-button">
                            <div className="label">
                                Articles <br />
                                <strong>by topic</strong>
                            </div>
                            <div className="icon">
                                <svg width="12" height="6">
                                    <path
                                        d="M0,0 L12,0 L6,6 Z"
                                        fill="currentColor"
                                    />
                                </svg>
                            </div>
                        </a>
                    </div>
                    <div>
                        <div className="site-primary-navigation">
                            <form
                                className="HeaderSearch"
                                action="/search"
                                method="GET"
                            >
                                <input
                                    type="search"
                                    name="q"
                                    placeholder="Search..."
                                />
                                <div className="icon">
                                    <FontAwesomeIcon icon={faSearch} />
                                </div>
                            </form>
                            <ul className="site-primary-links">
                                <li>
                                    <a
                                        href="/blog"
                                        data-track-note="header-navigation"
                                    >
                                        Latest
                                    </a>
                                </li>
                                <li>
                                    <a
                                        href="/about"
                                        data-track-note="header-navigation"
                                    >
                                        About
                                    </a>
                                </li>
                                <li>
                                    <a
                                        href="/donate"
                                        data-track-note="header-navigation"
                                    >
                                        Donate
                                    </a>
                                </li>
                            </ul>
                        </div>
                        <div className="site-secondary-navigation">
                            <ul className="site-secondary-links">
                                <li>
                                    <a
                                        href="/charts"
                                        data-track-note="header-navigation"
                                    >
                                        All charts
                                    </a>
                                </li>
                                {/* <li><a href="/teaching"  data-track-note="header-navigation">Teaching Hub</a></li> */}
                                <li>
                                    <a
                                        href="https://sdg-tracker.org"
                                        data-track-note="header-navigation"
                                    >
                                        Sustainable Development Goals Tracker
                                    </a>
                                </li>
                            </ul>
                        </div>
                    </div>
                </nav>
                <div className="header-logos-wrapper">
                    <a
                        href="https://www.oxfordmartin.ox.ac.uk/global-development"
                        className="oxford-logo"
                    >
                        <img
                            src={`${props.baseUrl}/oms-logo.svg`}
                            alt="Oxford Martin School logo"
                        />
                    </a>
                    <a
                        href="https://global-change-data-lab.org/"
                        className="gcdl-logo"
                    >
                        <img
                            src={`${props.baseUrl}/gcdl-logo.svg`}
                            alt="Global Change Data Lab logo"
                        />
                    </a>
                </div>
                <div className="mobile-site-navigation">
                    <button data-track-note="mobile-search-button">
                        <FontAwesomeIcon icon={faSearch} />
                    </button>
                    <button data-track-note="mobile-newsletter-button">
                        <FontAwesomeIcon icon={faEnvelopeOpenText} />
                    </button>
                    <button data-track-note="mobile-hamburger-button">
                        <FontAwesomeIcon icon={faBars} />
                    </button>
                </div>
            </div>
        </header>
        {props.hideAlertBanner !== true && <AlertBanner />}
    </>
)