Make the top bar go the full width of docs page

This commit is contained in:
Richard Feldman 2024-11-29 18:19:50 -05:00
parent 52b261cf79
commit be3c1a9445
No known key found for this signature in database
GPG key ID: DAC334802F365236
2 changed files with 139 additions and 86 deletions

View file

@ -1,75 +1,116 @@
<!doctype html> <!doctype html>
<html lang="en"> <html lang="en">
<head>
<head> <meta charset="utf-8" />
<meta charset="utf-8"> <!-- Page title -->
<!-- Page title --> <!-- <meta name="description" content="TODO populate this based on the module's description"> -->
<!-- <meta name="description" content="TODO populate this based on the module's description"> --> <meta name="viewport" content="width=device-width" />
<meta name="viewport" content="width=device-width"> <base href="<!-- base -->" />
<base href="<!-- base -->"> <script type="text/javascript" src="search.js" defer></script>
<script type="text/javascript" src="search.js" defer></script> <link rel="stylesheet" href="styles.css" />
<link rel="stylesheet" href="styles.css"> <link rel="icon" href="/favicon.svg" />
<link rel="icon" href="/favicon.svg"> <!-- Safari ignores rel="icon" and only respects rel="mask-icon". It will render the SVG with
<!-- Safari ignores rel="icon" and only respects rel="mask-icon". It will render the SVG with
fill="#000" unless this `color` attribute here is hardcoded (not a CSS `var()`) to override it. fill="#000" unless this `color` attribute here is hardcoded (not a CSS `var()`) to override it.
--> -->
<link rel="mask-icon" href="/favicon.svg" color="#7d59dd"> <link rel="mask-icon" href="/favicon.svg" color="#7d59dd" />
<!-- Prefetch links --> <!-- Prefetch links -->
</head> </head>
<body> <body>
<nav id="sidebar-nav"> <nav id="sidebar-nav">
<div class="module-links"> <div class="module-links">
<!-- Module links --> <!-- Module links -->
</div> </div>
</nav> </nav>
<div class="top-header-extension"> <div class="header-start-extension">
<!-- if the window gets big, this extends the purple bar on the top header to the left edge of the window -->
</div>
<header class="top-header">
<div class="pkg-and-logo">
<a class="logo" href="/" aria-labelledby="logo-link">
<svg viewBox="0 -6 51 58" fill="none" xmlns="http://www.w3.org/2000/svg" aria-labelledby="logo-link"
role="img">
<title id="logo-link">Return to Roc packages</title>
<polygon role="presentation"
points="0,0 23.8834,3.21052 37.2438,19.0101 45.9665,16.6324 50.5,22 45,22 44.0315,26.3689 26.4673,39.3424 27.4527,45.2132 17.655,53 23.6751,22.7086" />
</svg>
</a>
<!-- Package Name -->
</div>
<form id="module-search-form">
<input
id="module-search"
aria-labelledby="search-link"
type="text"
placeholder="Search"
role="combobox"
aria-autocomplete="list"
aria-expanded="false"
aria-controls="search-type-ahead"
/>
<label for="module-search" id="search-link">Search (press s)</label>
<span id="search-shortcut-key" aria-hidden="true">s</span>
<ul id="search-type-ahead" role="listbox" aria-label="Search Results" class="hidden">
<!-- Search Type Ahead -->
</ul>
</form>
<div id="llm-prompt-container">
<a id="llm-prompt-link" href="llms.txt" title="Documentation in a LLM friendly format">
LLM docs
</a>
</div>
<div class="top-header-triangle">
<!-- if the window gets big, this extends the purple bar on the top header to the left edge of the window --> <!-- if the window gets big, this extends the purple bar on the top header to the left edge of the window -->
</div> </div>
</header> <header class="top-header">
<main> <div class="pkg-and-logo">
<!-- Module Docs --> <a class="logo" href="/" aria-labelledby="logo-link">
</main> <svg
<footer> viewBox="0 -6 51 58"
<p>Made by people who like to make nice things.</p> fill="none"
</footer> xmlns="http://www.w3.org/2000/svg"
</body> aria-labelledby="logo-link"
role="img"
>
<title id="logo-link">Return to Roc packages</title>
<polygon
role="presentation"
points="0,0 23.8834,3.21052 37.2438,19.0101 45.9665,16.6324 50.5,22 45,22 44.0315,26.3689 26.4673,39.3424 27.4527,45.2132 17.655,53 23.6751,22.7086"
/>
</svg>
</a>
<!-- Package Name -->
</div>
<form id="module-search-form">
<input
id="module-search"
aria-labelledby="search-label"
type="text"
placeholder="Search"
role="combobox"
aria-autocomplete="list"
aria-expanded="false"
aria-controls="search-type-ahead"
/>
<label for="module-search" id="search-label"
>(press
<span id="search-shortcut-key" aria-hidden="true">s</span
>)</label
>
<!-- Magnifying Glass icon -->
<svg
version="1.1"
xmlns="http://www.w3.org/2000/svg"
class="search-icon"
xmlns:xlink="http://www.w3.org/1999/xlink"
width="24px"
height="24px"
viewBox="0 0 512 512"
xml:space="preserve"
>
<g>
<path
d="M449.803,62.197C408.443,20.807,353.85-0.037,299.646-0.006C245.428-0.037,190.85,20.807,149.49,62.197
C108.1,103.557,87.24,158.15,87.303,212.338c-0.047,37.859,10.359,75.766,30.547,109.359L15.021,424.525
c-20.016,20.016-20.016,52.453,0,72.469c20,20.016,52.453,20.016,72.453,0L190.318,394.15
c33.578,20.203,71.5,30.594,109.328,30.547c54.203,0.047,108.797-20.797,150.156-62.188
c41.375-41.359,62.234-95.938,62.188-150.172C512.053,158.15,491.178,103.557,449.803,62.197z M391.818,304.541
c-25.547,25.531-58.672,38.125-92.172,38.188c-33.5-0.063-66.609-12.656-92.188-38.188c-25.531-25.578-38.125-58.688-38.188-92.203
c0.063-33.484,12.656-66.609,38.188-92.172c25.578-25.531,58.688-38.125,92.188-38.188c33.5,0.063,66.625,12.656,92.188,38.188
c25.531,25.563,38.125,58.688,38.188,92.172C429.959,245.854,417.365,278.963,391.818,304.541z"
></path>
</g>
</svg>
<ul
id="search-type-ahead"
role="listbox"
aria-label="Search Results"
class="hidden"
>
<!-- Search Type Ahead -->
</ul>
</form>
<div id="llm-prompt-container">
<a
id="llm-prompt-link"
href="llms.txt"
title="Documentation in a LLM friendly format"
>
LLM docs
</a>
</div>
</header>
<div class="header-end-extension">
<!-- if the window gets big, this extends the purple bar on the top header to the right edge of the window -->
</div>
<main>
<!-- Module Docs -->
</main>
<footer>
<p>Made by people who like to make nice things.</p>
</footer>
</body>
</html> </html>

View file

@ -241,7 +241,7 @@ padding: 0px 16px;
width: 100%; width: 100%;
} }
.top-header-extension { .header-start-extension {
grid-column-start: before-sidebar; grid-column-start: before-sidebar;
grid-column-end: sidebar; grid-column-end: sidebar;
grid-row-start: top-header; grid-row-start: top-header;
@ -249,6 +249,14 @@ padding: 0px 16px;
background-color: var(--violet-bg); background-color: var(--violet-bg);
} }
.header-end-extension {
grid-column-start: end;
grid-column-end: end;
grid-row-start: top-header;
grid-row-end: top-header;
background-color: var(--violet-bg);
}
.top-header { .top-header {
grid-column-start: sidebar; grid-column-start: sidebar;
grid-column-end: end; grid-column-end: end;
@ -262,21 +270,11 @@ padding: 0px 16px;
font-family: var(--font-sans); font-family: var(--font-sans);
font-size: 24px; font-size: 24px;
height: 100%; height: 100%;
background-color: var(--violet-bg);
/* min-width must be set to something (even 0) for text-overflow: ellipsis to work in descendants, but we want this anyway. */ /* min-width must be set to something (even 0) for text-overflow: ellipsis to work in descendants, but we want this anyway. */
min-width: 1024px; min-width: 1024px;
} }
.top-header-triangle {
/* This used to be a clip-path, but Firefox on Android (at least as of early 2020)
* rendered the page extremely slowly in that version. With this approach it's super fast.
*/
width: 0;
height: 0;
border-style: solid;
border-width: var(--top-header-height) 0 0 48px;
border-color: transparent transparent transparent var(--violet-bg);
}
p { p {
overflow-wrap: break-word; overflow-wrap: break-word;
margin: 24px 0; margin: 24px 0;
@ -449,7 +447,6 @@ pre>samp {
height: 100%; height: 100%;
background-color: var(--violet-bg); background-color: var(--violet-bg);
position: relative; position: relative;
max-width: 500px;
flex-grow: 1; flex-grow: 1;
box-sizing: border-box; box-sizing: border-box;
padding: 0px var(--module-search-form-padding-width); padding: 0px var(--module-search-form-padding-width);
@ -463,6 +460,7 @@ pre>samp {
} }
#module-search { #module-search {
border-radius: 8px;
display: block; display: block;
position: relative; position: relative;
box-sizing: border-box; box-sizing: border-box;
@ -481,7 +479,7 @@ pre>samp {
opacity: 1; opacity: 1;
} }
#module-search:focus { #module-search:focus, #module-search:hover {
outline: 2px solid var(--faded-color); outline: 2px solid var(--faded-color);
} }
@ -505,6 +503,14 @@ pre>samp {
padding: 0; padding: 0;
} }
.search-icon {
fill: var(--faded-color);
pointer-events: none;
opacity: 0.6;
position: absolute;
right: 32px;
}
#search-type-ahead .type-ahead-link { #search-type-ahead .type-ahead-link {
font-size: 1rem; font-size: 1rem;
color: var(--text-color); color: var(--text-color);
@ -547,15 +553,22 @@ pre>samp {
background: var(--violet-bg); background: var(--violet-bg);
} }
#search-link { #module-search-form:focus-within #search-label, #module-search-form:focus-within .search-icon {
box-sizing: border-box;
display: none; display: none;
}
#search-label {
color: var(--faded-color);
box-sizing: border-box;
align-items: center; align-items: center;
font-size: 18px; font-size: 18px;
line-height: 18px; line-height: 18px;
padding: 12px 16px; padding: 12px 16px;
height: 48px; height: 48px;
cursor: pointer; pointer-events: none;
position: absolute;
top: 12px;
left: 96px;
} }
#search-shortcut-key { #search-shortcut-key {
@ -566,8 +579,7 @@ pre>samp {
font-style: normal; font-style: normal;
line-height: 15px; line-height: 15px;
opacity: 0.6; opacity: 0.6;
position: absolute; pointer-events: none;
right: 30px;
} }
#llm-prompt-container { #llm-prompt-container {