|
1 | 1 | <script> |
| 2 | + import { CURRENT_SEASON } from "@ftc-stats/common"; |
| 3 | + import { DONATIONS, GITHUB, DISCORD, STATUS } from "$lib/constants"; |
| 4 | + import Translate from "$lib/components/i18n/Translate.svelte"; |
2 | 5 | import DarkModeToggle from "./DarkModeToggle.svelte"; |
3 | 6 | import Hamburger from "./Hamburger.svelte"; |
4 | 7 | import LocaleSelect from "./LocaleSelect.svelte"; |
5 | 8 | import Logo from "./Logo.svelte"; |
6 | 9 | import Searchbar from "./search/Searchbar.svelte"; |
| 10 | +
|
| 11 | + const primaryLinks = [ |
| 12 | + { href: "/", label: "Home", key: "nav.home" }, |
| 13 | + { href: "/teams", label: "Teams", key: "nav.teams" }, |
| 14 | + { href: `/events/${CURRENT_SEASON}`, label: "Events", key: "nav.events" }, |
| 15 | + { href: "/compare", label: "Compare Teams", key: "nav.compare-teams" }, |
| 16 | + { href: `/records/${CURRENT_SEASON}/teams`, label: "Season Records", key: "nav.records" }, |
| 17 | + ]; |
| 18 | +
|
| 19 | + const secondaryLinks = [ |
| 20 | + { href: "/blog", label: "The Scouting Report", key: "nav.scouting-report" }, |
| 21 | + { href: "/about", label: "About", key: "nav.about" }, |
| 22 | + { href: "/api", label: "API", key: "nav.api" }, |
| 23 | + { href: "/privacy", label: "Privacy Policy", key: "nav.privacy" }, |
| 24 | + { href: DONATIONS, label: "Donate", key: "nav.donate", newTab: true }, |
| 25 | + ]; |
| 26 | +
|
| 27 | + const networkLinks = [ |
| 28 | + { href: GITHUB, label: "Github", key: "nav.github" }, |
| 29 | + { href: DISCORD, label: "Discord", key: "nav.discord" }, |
| 30 | + { href: STATUS, label: "Status", key: "nav.status" }, |
| 31 | + ]; |
7 | 32 | </script> |
8 | 33 |
|
9 | 34 | <nav> |
10 | 35 | <div class="left"> |
11 | 36 | <Hamburger /> |
12 | 37 | <Logo /> |
| 38 | + <div class="links"> |
| 39 | + {#each primaryLinks as link} |
| 40 | + <a href={link.href}> |
| 41 | + <Translate text={link.label} msgKey={link.key} /> |
| 42 | + </a> |
| 43 | + {/each} |
| 44 | + <details class="menu"> |
| 45 | + <summary> |
| 46 | + <Translate text="More" msgKey="nav.more" /> |
| 47 | + </summary> |
| 48 | + <div class="menu-panel"> |
| 49 | + {#each secondaryLinks as link} |
| 50 | + <a href={link.href} rel={link.newTab ? "noreferrer" : undefined} target={link.newTab ? "_blank" : undefined}> |
| 51 | + <Translate text={link.label} msgKey={link.key} /> |
| 52 | + </a> |
| 53 | + {/each} |
| 54 | + <hr /> |
| 55 | + {#each networkLinks as link} |
| 56 | + <a href={link.href} rel="noreferrer" target="_blank"> |
| 57 | + <Translate text={link.label} msgKey={link.key} /> |
| 58 | + </a> |
| 59 | + {/each} |
| 60 | + </div> |
| 61 | + </details> |
| 62 | + </div> |
13 | 63 | </div> |
14 | 64 |
|
15 | | - <div class="right"> |
| 65 | + <div class="center"> |
16 | 66 | <Searchbar /> |
| 67 | + </div> |
| 68 | + |
| 69 | + <div class="right"> |
17 | 70 | <LocaleSelect /> |
18 | 71 | <DarkModeToggle /> |
19 | 72 | </div> |
|
35 | 88 |
|
36 | 89 | display: flex; |
37 | 90 | align-items: center; |
38 | | - justify-content: space-between; |
| 91 | + gap: var(--lg-gap); |
39 | 92 | } |
40 | 93 |
|
41 | 94 | nav::before { |
|
51 | 104 | .left { |
52 | 105 | display: flex; |
53 | 106 | align-items: center; |
| 107 | + gap: var(--md-gap); |
| 108 | + } |
| 109 | +
|
| 110 | + .links { |
| 111 | + display: flex; |
| 112 | + align-items: center; |
| 113 | + gap: var(--sm-gap); |
| 114 | + } |
| 115 | +
|
| 116 | + .links a, |
| 117 | + summary { |
| 118 | + font-size: var(--sm-font-size); |
| 119 | + font-weight: 700; |
| 120 | + letter-spacing: 0.08em; |
| 121 | + text-transform: uppercase; |
| 122 | + color: var(--text-color); |
| 123 | +
|
| 124 | + padding: var(--sm-pad) var(--md-pad); |
| 125 | + border-radius: var(--control-radius); |
| 126 | + border: var(--border-width) solid transparent; |
| 127 | + cursor: pointer; |
| 128 | + white-space: nowrap; |
| 129 | + } |
| 130 | +
|
| 131 | + .links a:hover, |
| 132 | + summary:hover { |
| 133 | + background: var(--theme-soft-color); |
| 134 | + border-color: var(--sep-color); |
| 135 | + text-decoration: none; |
| 136 | + } |
| 137 | +
|
| 138 | + details { |
| 139 | + position: relative; |
| 140 | + } |
| 141 | +
|
| 142 | + summary { |
| 143 | + list-style: none; |
| 144 | + } |
| 145 | +
|
| 146 | + summary::-webkit-details-marker { |
| 147 | + display: none; |
| 148 | + } |
| 149 | +
|
| 150 | + .menu-panel { |
| 151 | + position: absolute; |
| 152 | + top: calc(100% + var(--sm-gap)); |
| 153 | + right: 0; |
| 154 | + min-width: 220px; |
| 155 | +
|
| 156 | + background: var(--fg-color); |
| 157 | + border: var(--border-width) solid var(--sep-color); |
| 158 | + box-shadow: var(--card-shadow); |
| 159 | + padding: var(--md-pad); |
| 160 | + display: grid; |
| 161 | + gap: var(--sm-gap); |
| 162 | + z-index: var(--navbar-zi); |
| 163 | + } |
| 164 | +
|
| 165 | + .menu-panel a { |
| 166 | + padding: var(--sm-pad) var(--md-pad); |
| 167 | + font-size: var(--sm-font-size); |
| 168 | + text-transform: none; |
| 169 | + letter-spacing: 0.02em; |
| 170 | + } |
| 171 | +
|
| 172 | + .menu-panel hr { |
| 173 | + border: none; |
| 174 | + border-top: var(--border-width) solid var(--sep-color); |
| 175 | + margin: var(--sm-gap) 0; |
| 176 | + } |
| 177 | +
|
| 178 | + .center { |
| 179 | + flex: 1; |
| 180 | + display: flex; |
| 181 | + justify-content: center; |
54 | 182 | } |
55 | 183 |
|
56 | 184 | .right { |
57 | 185 | display: flex; |
58 | 186 | align-items: center; |
59 | | - gap: var(--lg-gap); |
| 187 | + gap: var(--md-gap); |
| 188 | + } |
| 189 | +
|
| 190 | + @media (max-width: 1200px) { |
| 191 | + .links { |
| 192 | + display: none; |
| 193 | + } |
| 194 | +
|
| 195 | + .center { |
| 196 | + justify-content: flex-start; |
| 197 | + } |
| 198 | + } |
| 199 | +
|
| 200 | + @media (max-width: 850px) { |
| 201 | + .center { |
| 202 | + justify-content: flex-end; |
| 203 | + } |
60 | 204 | } |
61 | 205 | </style> |
0 commit comments