Closes #261
This commit is contained in:
parent
47deafe2b7
commit
5c08cfe05c
8 changed files with 133 additions and 19 deletions
18
app/dist/scripts/api.js
vendored
18
app/dist/scripts/api.js
vendored
|
@ -32,6 +32,22 @@ document.querySelector(".api-toc__search-clear").addEventListener("click", () =>
|
||||||
reinitJets();
|
reinitJets();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Handle menu toggle for mobile
|
||||||
|
if (document.getElementById("toggle-menu")) {
|
||||||
|
document.getElementById("toggle-menu").addEventListener("click", () => {
|
||||||
|
document.querySelector("body").classList.toggle("disable-scrolling");
|
||||||
|
document.querySelector(".api-toc").classList.toggle("active");
|
||||||
|
});
|
||||||
|
|
||||||
|
// Handle menu toggle when clicking on commands
|
||||||
|
document.querySelectorAll(".api-toc__command a").forEach(command => {
|
||||||
|
command.addEventListener("click", () => {
|
||||||
|
document.querySelector("body").classList.remove("disable-scrolling");
|
||||||
|
document.querySelector(".api-toc").classList.remove("active");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Code toggles
|
// Code toggles
|
||||||
|
@ -66,6 +82,6 @@ function reinitJets() {
|
||||||
contentTag,
|
contentTag,
|
||||||
searchTag: "#input-search"
|
searchTag: "#input-search"
|
||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById("input-search").focus();
|
document.getElementById("input-search").focus();
|
||||||
}
|
}
|
||||||
|
|
29
app/dist/scripts/app.js
vendored
29
app/dist/scripts/app.js
vendored
|
@ -1,4 +1,4 @@
|
||||||
"use strict"; /* global document, history, location, navigator, send, window */
|
"use strict"; /* global document, history, location, send, window */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,11 +16,26 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Browsers not Firefox do not yet support `text-orientation` and/or `writing-mode`
|
// Menu toggle for Glossary
|
||||||
if (
|
if (
|
||||||
!/Firefox[/\s](\d+\.\d+)/.test(navigator.userAgent) &&
|
window.innerWidth <= 800 &&
|
||||||
document.querySelector(".component--glossary-toc-toggle")
|
window.location.pathname.split("/").pop() === "glossary"
|
||||||
) document.querySelector(".component--glossary-toc-toggle").classList.add("noncompliant-fix");
|
) {
|
||||||
|
document.querySelector(".page__header__title").insertAdjacentHTML("afterbegin", "<button id='toggle-menu'>Menu</button>");
|
||||||
|
|
||||||
|
document.getElementById("toggle-menu").addEventListener("click", () => {
|
||||||
|
document.querySelector(".component--glossary-toc").classList.toggle("active");
|
||||||
|
document.querySelector("body").classList.toggle("disable-scrolling");
|
||||||
|
});
|
||||||
|
|
||||||
|
// Handle menu toggle when clicking on commands
|
||||||
|
document.querySelectorAll(".component--glossary-toc a").forEach(keyword => {
|
||||||
|
keyword.addEventListener("click", () => {
|
||||||
|
document.querySelector("body").classList.remove("disable-scrolling");
|
||||||
|
document.querySelector(".component--glossary-toc").classList.remove("active");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,7 +52,7 @@ document.querySelectorAll("a[href^='#']").forEach(anchor => {
|
||||||
let elementOffset;
|
let elementOffset;
|
||||||
|
|
||||||
if (document.getElementById(element)) {
|
if (document.getElementById(element)) {
|
||||||
elementOffset = document.getElementById(element).offsetTop - 74;
|
elementOffset = document.getElementById(element).offsetTop - 150;
|
||||||
window.scroll({ top: elementOffset, behavior: "smooth" });
|
window.scroll({ top: elementOffset, behavior: "smooth" });
|
||||||
history.pushState({}, "", `#${element}`); // Add hash to URL bar
|
history.pushState({}, "", `#${element}`); // Add hash to URL bar
|
||||||
}
|
}
|
||||||
|
@ -81,7 +96,7 @@ function scrollToElementOnLoad() {
|
||||||
let elementOffset;
|
let elementOffset;
|
||||||
|
|
||||||
if (document.getElementById(element)) {
|
if (document.getElementById(element)) {
|
||||||
elementOffset = document.getElementById(element).offsetTop - 74;
|
elementOffset = document.getElementById(element).offsetTop - 150;
|
||||||
window.scroll({ top: elementOffset, behavior: "smooth" });
|
window.scroll({ top: elementOffset, behavior: "smooth" });
|
||||||
}
|
}
|
||||||
}, 150);
|
}, 150);
|
||||||
|
|
|
@ -30,6 +30,14 @@ main {
|
||||||
padding-top: 4rem;
|
padding-top: 4rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.disable-scrolling {
|
||||||
|
top: 0; right: 0;
|
||||||
|
bottom: 0; left: 0;
|
||||||
|
|
||||||
|
overflow: hidden;
|
||||||
|
position: fixed;
|
||||||
|
}
|
||||||
|
|
||||||
.inner-wrap {
|
.inner-wrap {
|
||||||
max-width: 1200px;
|
max-width: 1200px;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
|
@ -85,7 +93,7 @@ sub {
|
||||||
}
|
}
|
||||||
|
|
||||||
frame-viewer {
|
frame-viewer {
|
||||||
width: 100%; height: calc(100vh - 4rem); // TODO: Update when new navigation is merged
|
width: 100%; height: calc(100vh - 4rem);
|
||||||
display: block;
|
display: block;
|
||||||
|
|
||||||
iframe {
|
iframe {
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
.api-toc {
|
.api-toc {
|
||||||
width: 200px; height: calc(100vh - 4rem); // navigation is 4rem tall
|
width: 200px; height: calc(100vh - 4rem); // navigation is 4rem tall
|
||||||
bottom: 0; left: 0;
|
bottom: 0;
|
||||||
|
|
||||||
background-color: $lbry-white;
|
background-color: $lbry-white;
|
||||||
border-right: 1px solid $lbry-gray-1;
|
border-right: 1px solid $lbry-gray-1;
|
||||||
|
@ -33,8 +33,25 @@
|
||||||
position: fixed;
|
position: fixed;
|
||||||
z-index: 3;
|
z-index: 3;
|
||||||
|
|
||||||
|
@media (min-width: 801px) {
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 800px) {
|
@media (max-width: 800px) {
|
||||||
display: none;
|
height: calc(100% - 4rem);
|
||||||
|
top: 4rem;
|
||||||
|
padding-top: 3.5rem;
|
||||||
|
transition: left 0.2s;
|
||||||
|
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
|
|
||||||
|
&:not(.active) {
|
||||||
|
left: -200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,6 +276,7 @@
|
||||||
.right {
|
.right {
|
||||||
width: 70%;
|
width: 70%;
|
||||||
float: right;
|
float: right;
|
||||||
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
&::after {
|
&::after {
|
||||||
|
@ -302,6 +320,12 @@
|
||||||
font-size: 0.8rem;
|
font-size: 0.8rem;
|
||||||
transition: background-color 0.2s;
|
transition: background-color 0.2s;
|
||||||
|
|
||||||
|
&.menu {
|
||||||
|
@media (min-width: 801px) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&:not(:last-of-type) {
|
&:not(:last-of-type) {
|
||||||
margin-right: 0.5rem;
|
margin-right: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
.page__header {
|
.page__header {
|
||||||
@include center;
|
@include center;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
top: 4rem;
|
||||||
|
|
||||||
background-color: $lbry-black;
|
background-color: $lbry-black;
|
||||||
background-position: center;
|
background-position: center;
|
||||||
|
@ -21,7 +22,11 @@
|
||||||
color: $lbry-white;
|
color: $lbry-white;
|
||||||
padding-right: env(safe-area-inset-right);
|
padding-right: env(safe-area-inset-right);
|
||||||
padding-left: env(safe-area-inset-left);
|
padding-left: env(safe-area-inset-left);
|
||||||
position: relative;
|
position: sticky;
|
||||||
|
z-index: 2;
|
||||||
|
|
||||||
|
// GOOD OL' SAFARI
|
||||||
|
position: -webkit-sticky; // sass-lint:disable-line no-duplicate-properties
|
||||||
}
|
}
|
||||||
|
|
||||||
.page__header__title {
|
.page__header__title {
|
||||||
|
@ -39,6 +44,29 @@
|
||||||
padding-top: 1rem;
|
padding-top: 1rem;
|
||||||
padding-bottom: 1rem;
|
padding-bottom: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (min-width: 801px) {
|
||||||
|
button {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 800px) {
|
||||||
|
button {
|
||||||
|
margin-right: 1rem; padding-right: 1rem;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
width: 1px; height: 100%;
|
||||||
|
top: 0; right: 0;
|
||||||
|
|
||||||
|
background-color: $lbry-white;
|
||||||
|
content: "";
|
||||||
|
opacity: 0.3;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.page__content {
|
.page__content {
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
.component--glossary-toc {
|
.component--glossary-toc {
|
||||||
width: 200px; height: calc(100vh - 4rem);
|
width: 200px; height: calc(100vh - 4rem);
|
||||||
bottom: 0; left: 0;
|
bottom: 0;
|
||||||
|
|
||||||
background-color: $lbry-white;
|
background-color: $lbry-white;
|
||||||
border-right: 1px solid $lbry-gray-1;
|
border-right: 1px solid $lbry-gray-1;
|
||||||
|
@ -28,15 +28,37 @@
|
||||||
line-height: 1.33;
|
line-height: 1.33;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
padding-top: 0.25rem !important;
|
|
||||||
padding-left: 0 !important;
|
padding-left: 0 !important;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
|
||||||
@media (max-width: 800px) {
|
@media (min-width: 801px) {
|
||||||
display: none;
|
left: 0;
|
||||||
|
padding-top: 0.25rem !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 800px) {
|
||||||
|
height: 100%;
|
||||||
|
top: 0;
|
||||||
|
padding-top: 9rem !important;
|
||||||
|
// padding-bottom: 4rem;
|
||||||
|
transition: left 0.2s;
|
||||||
|
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
|
|
||||||
|
&:not(.active) {
|
||||||
|
left: -200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// @media (max-width: 800px) {
|
||||||
|
// display: none;
|
||||||
|
// }
|
||||||
|
|
||||||
li {
|
li {
|
||||||
list-style-type: none !important;
|
list-style-type: none !important;
|
||||||
|
|
||||||
|
|
|
@ -309,6 +309,7 @@ function renderReturns(args) {
|
||||||
|
|
||||||
function renderToggles(onSdkPage) {
|
function renderToggles(onSdkPage) {
|
||||||
return [
|
return [
|
||||||
|
"<button class='api-content__item menu' id='toggle-menu'>menu</button>",
|
||||||
!onSdkPage ? "<button class='api-content__item' id='toggle-cli' type='button'>cli</button>" : "",
|
!onSdkPage ? "<button class='api-content__item' id='toggle-cli' type='button'>cli</button>" : "",
|
||||||
"<button class='api-content__item' id='toggle-curl' type='button'>curl</button>",
|
"<button class='api-content__item' id='toggle-curl' type='button'>curl</button>",
|
||||||
onSdkPage ? "<button class='api-content__item' id='toggle-lbrynet' type='button'>lbrynet</button>" : "",
|
onSdkPage ? "<button class='api-content__item' id='toggle-lbrynet' type='button'>lbrynet</button>" : "",
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/polyfill": "^7.4.4",
|
"@babel/polyfill": "^7.4.4",
|
||||||
"@inc/fastify-ws": "^1.1.0",
|
"@inc/fastify-ws": "^1.1.0",
|
||||||
"@octokit/rest": "^16.25.3",
|
"@octokit/rest": "^16.25.4",
|
||||||
"@slack/client": "^5.0.1",
|
"@slack/client": "^5.0.1",
|
||||||
"async": "^2.6.2",
|
"async": "^2.6.2",
|
||||||
"async-es": "^2.6.2",
|
"async-es": "^2.6.2",
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
"dedent": "^0.7.0",
|
"dedent": "^0.7.0",
|
||||||
"dotenv": "^8.0.0",
|
"dotenv": "^8.0.0",
|
||||||
"fastify": "~2.3.0",
|
"fastify": "~2.3.0",
|
||||||
"fastify-compress": "^0.9.0",
|
"fastify-compress": "^0.10.0",
|
||||||
"fastify-helmet": "^3.0.0",
|
"fastify-helmet": "^3.0.0",
|
||||||
"fastify-static": "^2.4.0",
|
"fastify-static": "^2.4.0",
|
||||||
"front-matter": "^3.0.2",
|
"front-matter": "^3.0.2",
|
||||||
|
@ -67,7 +67,7 @@
|
||||||
"@lbry/color": "^1.1.1",
|
"@lbry/color": "^1.1.1",
|
||||||
"@lbry/components": "^2.7.1",
|
"@lbry/components": "^2.7.1",
|
||||||
"eslint": "^5.16.0",
|
"eslint": "^5.16.0",
|
||||||
"husky": "^2.2.0",
|
"husky": "^2.3.0",
|
||||||
"nodemon": "^1.19.0",
|
"nodemon": "^1.19.0",
|
||||||
"npm-run-all": "^4.1.5",
|
"npm-run-all": "^4.1.5",
|
||||||
"pino-pretty": "^3.0.0",
|
"pino-pretty": "^3.0.0",
|
||||||
|
|
Loading…
Reference in a new issue