mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-23 10:07:48 -06:00
A Wanted files link sits in the bar on every page and every width, beside the search and menu buttons on a phone, current on its own page. Below 27rem the site name is kept for screen readers only. files/ and wanted/ link each other in one line.
152 lines
4.7 KiB
Plaintext
152 lines
4.7 KiB
Plaintext
---
|
|
// Starlight's header bar, and under it the five sections of the site as
|
|
// tabs: the funnel (Start here to Contribute) is the site's structure, so it
|
|
// sits where every docs site puts its sections. On a phone the tabs stay the
|
|
// first row of the menu, where the sidebar lists them.
|
|
// The wanted page is the one call to contribute, in the bar on every page
|
|
// and every width: on a phone it sits beside the search and menu buttons.
|
|
import Default from '@astrojs/starlight/components/Header.astro';
|
|
|
|
const topics = Astro.locals.starlightSidebarTopics?.topics ?? [];
|
|
const base = import.meta.env.BASE_URL.replace(/\/?$/, '/');
|
|
const wanted = `${base}wanted/`;
|
|
const onWanted = Astro.url.pathname.replace(/\/?$/, '/') === wanted;
|
|
---
|
|
|
|
<div class="rb-header-bar">
|
|
<Default />
|
|
<a class="rb-wanted-link print:hidden" href={wanted} aria-current={onWanted ? 'page' : undefined}>Wanted files</a>
|
|
</div>
|
|
{
|
|
topics.length > 0 && (
|
|
<nav class="rb-tabs print:hidden" aria-label="Sections">
|
|
<ul>
|
|
{topics.map((topic) => (
|
|
<li>
|
|
<a href={topic.link} aria-current={topic.isCurrent ? 'true' : undefined}>
|
|
{topic.label}
|
|
</a>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
</nav>
|
|
)
|
|
}
|
|
|
|
<!-- Global: the bar height and the sidebar's topic list belong to other components. -->
|
|
<style is:global>
|
|
.rb-header-bar {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: var(--sl-nav-gap);
|
|
height: 100%;
|
|
}
|
|
.rb-header-bar > .header { flex: 1; min-width: 0; }
|
|
/* A call to contribute: an outlined pill in the link colour, filled on
|
|
its own page. The colours are the theme's, in light and dark. */
|
|
.rb-wanted-link {
|
|
display: inline-flex;
|
|
flex: none;
|
|
align-items: center;
|
|
min-height: 2rem;
|
|
padding: 0 0.75rem;
|
|
border: 1px solid var(--rb-link);
|
|
border-radius: 999px;
|
|
color: var(--rb-link);
|
|
font-size: var(--sl-text-sm);
|
|
font-weight: 600;
|
|
text-decoration: none;
|
|
white-space: nowrap;
|
|
}
|
|
.rb-wanted-link:hover { background: var(--sl-color-accent-low); }
|
|
.rb-wanted-link:focus-visible { outline: 2px solid var(--rb-link); outline-offset: 2px; }
|
|
.rb-wanted-link[aria-current='page'] { background: var(--rb-link); color: var(--sl-color-black); }
|
|
/* Below 27rem the bar cannot hold the name, the search, the link and the
|
|
menu: the logo stays as the home link and the name is kept for screen
|
|
readers, rather than cut to "Retr". */
|
|
@media (max-width: 26.99rem) {
|
|
.site-title span {
|
|
position: absolute;
|
|
width: 1px;
|
|
height: 1px;
|
|
overflow: hidden;
|
|
clip-path: inset(50%);
|
|
white-space: nowrap;
|
|
}
|
|
}
|
|
.rb-tabs { display: none; }
|
|
|
|
/* "Look up this hash", the first result of a hash typed in the search (site.ts). */
|
|
.rb-search-hash {
|
|
margin: 1rem 0 0;
|
|
padding: 0.75rem 1rem;
|
|
border: 1px solid var(--sl-color-gray-5);
|
|
border-radius: 0.5rem;
|
|
overflow-wrap: anywhere;
|
|
}
|
|
.rb-search-hash p { margin: 0; }
|
|
.rb-search-hash a { font-weight: 600; }
|
|
/* Under a hash, the pages that only mention its characters stay folded. */
|
|
.pagefind-ui__drawer[data-rb-hash]:not([data-rb-pages-shown]) .pagefind-ui__results-area { display: none; }
|
|
.rb-search-hash .rb-search-pages {
|
|
min-height: 24px;
|
|
margin-top: 0.5rem;
|
|
padding: 0;
|
|
border: 0;
|
|
background: none;
|
|
color: var(--sl-color-gray-2);
|
|
font: inherit;
|
|
font-size: var(--sl-text-sm);
|
|
text-decoration: underline;
|
|
cursor: pointer;
|
|
}
|
|
.rb-search-hash .rb-search-pages::before { content: '+ '; }
|
|
.rb-search-hash .rb-search-pages[aria-expanded='true']::before { content: '- '; }
|
|
/* Pagefind's own display rules would show what site.ts hides. */
|
|
#starlight__search [hidden] { display: none !important; }
|
|
|
|
@media (min-width: 50rem) {
|
|
:root {
|
|
--rb-nav-bar: 4rem;
|
|
--rb-tab-row: 2.75rem;
|
|
--sl-nav-height: calc(var(--rb-nav-bar) + var(--rb-tab-row));
|
|
}
|
|
.rb-header-bar { height: calc(100% - var(--rb-tab-row)); }
|
|
.site-title { height: calc(var(--rb-nav-bar) - 2 * var(--sl-nav-pad-y)); }
|
|
.rb-tabs {
|
|
display: block;
|
|
position: absolute;
|
|
inset-inline: 0;
|
|
bottom: 0;
|
|
height: var(--rb-tab-row);
|
|
padding-inline: var(--sl-nav-pad-x);
|
|
}
|
|
.rb-tabs ul {
|
|
display: flex;
|
|
gap: 1.75rem;
|
|
height: 100%;
|
|
margin: 0;
|
|
padding: 0;
|
|
list-style: none;
|
|
}
|
|
.rb-tabs li { display: flex; }
|
|
.rb-tabs a {
|
|
display: flex;
|
|
align-items: center;
|
|
border-bottom: 2px solid transparent;
|
|
color: var(--sl-color-gray-2);
|
|
font-size: var(--sl-text-sm);
|
|
text-decoration: none;
|
|
white-space: nowrap;
|
|
}
|
|
.rb-tabs a:hover { color: var(--sl-color-white); }
|
|
.rb-tabs a[aria-current] {
|
|
border-bottom-color: currentColor;
|
|
color: var(--sl-color-white);
|
|
font-weight: 600;
|
|
}
|
|
/* The header holds the sections: the sidebar lists the pages of one. */
|
|
.sidebar-content ul.starlight-sidebar-topics { display: none; }
|
|
}
|
|
</style>
|