_navbar.html (3031B)
1 {% from "_icons.html" import icon %} 2 {#- Site header. `page` marks the active link. Keep this free of per-request data so the "instant folders" 3 shell (api/shell) and the server render stay identical. -#} 4 {% macro nav_link(href, key, label, icon_name, extra='') -%} 5 <a href="{{ href }}" class="nav-link {{ extra }}{{ ' is-active' if page == key }}"{{ ' aria-current="page"'|safe if page == key }}>{{ icon(icon_name) }}<span>{{ label }}</span></a> 6 {%- endmacro %} 7 <header class="site-header"> 8 <div class="site-header__inner"> 9 <a href="/" class="wordmark" aria-label="amit/cdn, home"> 10 <img src="/static/icons/logo.svg" alt="" width="28" height="28" decoding="async"> 11 <span class="wordmark__text">amit<b>/</b>cdn</span> 12 </a> 13 14 <div class="site-header__tools"> 15 <a href="/find" class="icon-btn quick-action{{ ' is-active' if page == 'search' }}" aria-label="Find a file" title="Find"{{ ' aria-current="page"'|safe if page == 'search' }}>{{ icon('search', 18) }}</a> 16 <a href="/new" class="icon-btn quick-action quick-action--primary{{ ' is-active' if page == 'upload' }}" aria-label="Upload" title="Upload"{{ ' aria-current="page"'|safe if page == 'upload' }}>{{ icon('upload', 18) }}</a> 17 <button type="button" class="icon-btn theme-toggle" data-action="theme-toggle" aria-label="Switch colour theme" title="Switch colour theme"> 18 <span class="i-sun">{{ icon('sun', 18) }}</span><span class="i-moon">{{ icon('moon', 18) }}</span> 19 </button> 20 <button type="button" class="icon-btn nav-toggle" data-action="nav-toggle" aria-label="Toggle menu" aria-expanded="false" aria-controls="primary-nav"> 21 <span class="i-open">{{ icon('menu', 20) }}</span><span class="i-close">{{ icon('close', 20) }}</span> 22 </button> 23 </div> 24 25 <nav class="site-nav" id="primary-nav" aria-label="Primary"> 26 {{ nav_link('/find', 'search', 'Find', 'search', 'nav-dup') }} 27 {{ nav_link('/shorten', 'shorten', 'Shorten', 'link') }} 28 {{ nav_link('/gh-sync', 'gh-sync', 'Sync', 'sync') }} 29 {{ nav_link('/documentation', 'documentation', 'Docs', 'book') }} 30 <div class="more"> 31 <button type="button" class="nav-link more__toggle{{ ' is-active' if page in ('history', 'stats') }}" data-action="more-toggle" aria-expanded="false" aria-haspopup="true" aria-controls="more-menu"> 32 <span>More</span>{{ icon('chevron-down', 14) }} 33 </button> 34 <div class="more__menu" id="more-menu"> 35 {{ nav_link('/history', 'history', 'History', 'clock') }} 36 {{ nav_link('/stats', 'stats', 'Stats', 'bars') }} 37 <a href="/admin" class="nav-link">{{ icon('shield') }}<span>Admin</span></a> 38 </div> 39 </div> 40 {{ nav_link('/new', 'upload', 'Upload', 'upload', 'nav-cta nav-dup') }} 41 </nav> 42 </div> 43 </header>