From 086b14e81643417fe5752335fa4ddeed24d030c6 Mon Sep 17 00:00:00 2001 From: hunicus <93150691+hunicus@users.noreply.github.com> Date: Fri, 17 Dec 2021 07:00:48 -0500 Subject: [PATCH] Add various ux improvements for mobile doc menu --- .../clipboard/clipboard.component.html | 2 +- .../docs/api-docs-nav.component.html | 92 +++++++++---------- .../components/docs/api-docs-nav.component.ts | 1 + .../components/docs/api-docs.component.html | 12 ++- .../components/docs/api-docs.component.scss | 40 ++++---- .../app/components/docs/api-docs.component.ts | 6 +- .../app/components/docs/docs.component.scss | 1 + 7 files changed, 80 insertions(+), 74 deletions(-) diff --git a/frontend/src/app/components/clipboard/clipboard.component.html b/frontend/src/app/components/clipboard/clipboard.component.html index 1150074ac..1a92cc9c9 100644 --- a/frontend/src/app/components/clipboard/clipboard.component.html +++ b/frontend/src/app/components/clipboard/clipboard.component.html @@ -1,5 +1,5 @@ - diff --git a/frontend/src/app/components/docs/api-docs-nav.component.html b/frontend/src/app/components/docs/api-docs-nav.component.html index 2103dd776..43de4d1df 100644 --- a/frontend/src/app/components/docs/api-docs-nav.component.html +++ b/frontend/src/app/components/docs/api-docs-nav.component.html @@ -1,63 +1,63 @@

General

-GET Difficulty Adjustment +GET Difficulty Adjustment

Markets

-GET Market Currencies -GET Market Depth -GET Market HLOC -GET Markets -GET Market Offers -GET Market Ticker -GET Market Trades -GET Market Volumes +GET Market Currencies +GET Market Depth +GET Market HLOC +GET Markets +GET Market Offers +GET Market Ticker +GET Market Trades +GET Market Volumes

General

-GET Stats +GET Stats

Addresses

-GET Address -GET Address Transactions -GET Address Transactions Chain -GET Address Transactions Mempool -GET Address UTXO +GET Address +GET Address Transactions +GET Address Transactions Chain +GET Address Transactions Mempool +GET Address UTXO

Assets

-GET Assets -GET Asset Transactions -GET Asset Supply +GET Assets +GET Asset Transactions +GET Asset Supply

Blocks

-GET Block -GET Block Header -GET Block Height -GET Block Raw -GET Block Status -GET Block Tip Height -GET Block Tip Hash -GET Block Transaction ID -GET Block Transaction IDs -GET Block Transactions -GET Blocks -GET Blocks +GET Block +GET Block Header +GET Block Height +GET Block Raw +GET Block Status +GET Block Tip Height +GET Block Tip Hash +GET Block Transaction ID +GET Block Transaction IDs +GET Block Transactions +GET Blocks +GET Blocks

Fees

-GET Mempool Blocks Fees -GET Recommended Fees +GET Mempool Blocks Fees +GET Recommended Fees

Mempool

-GET Mempool -GET Mempool Transaction IDs -GET Mempool Recent +GET Mempool +GET Mempool Transaction IDs +GET Mempool Recent

Transactions

-GET Children Pay for Parent -GET Transaction -GET Transaction Hex -GET Transaction Merkleblock Proof -GET Transaction Merkle Proof -GET Transaction Outspend -GET Transaction Outspends -GET Transaction Raw -GET Transaction Status -GET Transactions -POST Transaction +GET Children Pay for Parent +GET Transaction +GET Transaction Hex +GET Transaction Merkleblock Proof +GET Transaction Merkle Proof +GET Transaction Outspend +GET Transaction Outspends +GET Transaction Raw +GET Transaction Status +GET Transactions +POST Transaction diff --git a/frontend/src/app/components/docs/api-docs-nav.component.ts b/frontend/src/app/components/docs/api-docs-nav.component.ts index 860e1d7ad..967b355f3 100644 --- a/frontend/src/app/components/docs/api-docs-nav.component.ts +++ b/frontend/src/app/components/docs/api-docs-nav.component.ts @@ -8,6 +8,7 @@ import { Component, OnInit, Input } from '@angular/core'; export class ApiDocsNavComponent implements OnInit { @Input() network: any; + @Input() collapseItem: any; constructor() { } diff --git a/frontend/src/app/components/docs/api-docs.component.html b/frontend/src/app/components/docs/api-docs.component.html index b661dc494..1b0f2a66b 100644 --- a/frontend/src/app/components/docs/api-docs.component.html +++ b/frontend/src/app/components/docs/api-docs.component.html @@ -3,25 +3,27 @@
-
+
-

Reference for the {{ network.val === '' ? 'Bitcoin' : network.val.charAt(0).toUpperCase() + network.val.slice(1) }} API service.

+

Reference for the {{ network.val === '' ? 'Bitcoin' : network.val.charAt(0).toUpperCase() + network.val.slice(1) }} API service.

-
- +
+
- +
+
+
diff --git a/frontend/src/app/components/docs/api-docs.component.scss b/frontend/src/app/components/docs/api-docs.component.scss index 2d5a8447d..d03608e92 100644 --- a/frontend/src/app/components/docs/api-docs.component.scss +++ b/frontend/src/app/components/docs/api-docs.component.scss @@ -22,6 +22,10 @@ li.nav-item { } } +.no-bottom-space { + margin-bottom: 0; +} + .nav-tabs .nav-link.active { border-bottom: 1px solid #fff; @media (min-width: 676px){ @@ -72,16 +76,16 @@ li.nav-item { padding: 15px; } -.doc-nav-desktop { +#doc-nav-desktop { width: 300px; } -.doc-nav-desktop.relative { +#doc-nav-desktop.relative { float: left; overflow: hidden; } -.doc-nav-desktop.fixed { +#doc-nav-desktop.fixed { float: unset; position: fixed; top: 20px; @@ -122,13 +126,10 @@ li.nav-item { padding: 1rem 1.3rem 1rem 1.3rem; font-weight: bold; border-radius: 0.25rem; - margin: 40px 0 20px 0; + margin: 20px 0 20px 0; font-size: 24px; position: relative; } -.endpoint-container .section-header:first-child { - margin-top: 20px; -} .endpoint-container .section-header:hover { text-decoration: none; } @@ -146,32 +147,27 @@ li.nav-item { float: right; } -.doc-nav-mobile.relative { - -} - -.doc-nav-mobile.relative { - position: relative; -} - -.doc-nav-mobile.fixed { +#doc-nav-mobile { position: fixed; top: 20px; width: calc(100% - 60px); z-index: 100; } -.doc-nav-mobile > div { +#doc-nav-mobile > div { background-color: #2d3348; z-index: 100; - border-radius: 0.25rem; + border-radius: 0 0 0.5rem 0.5rem; + height: 55vh; + overflow-y: auto; } -#doc-nav-mobile-toggle { +#doc-nav-mobile button { width: 100%; background-color: #105fb0; color: #fff; border-color: #105fb0; + border-radius: 0.5rem 0.5rem 0 0; } @media (max-width: 992px) { @@ -195,6 +191,12 @@ li.nav-item { left: 0; bottom: -50px; } + + .endpoint-container:before { + height: 30px; + margin-top: -12px; + } + } @media (min-width: 992px) { diff --git a/frontend/src/app/components/docs/api-docs.component.ts b/frontend/src/app/components/docs/api-docs.component.ts index 4b5f985a8..c209a2771 100644 --- a/frontend/src/app/components/docs/api-docs.component.ts +++ b/frontend/src/app/components/docs/api-docs.component.ts @@ -18,7 +18,7 @@ export class ApiDocsComponent implements OnInit { baseNetworkUrl = ''; @Input() restTabActivated: Boolean; desktopDocsNavPosition = "relative"; - mobileDocsNavPosition = "relative"; + showFloatingDocsNav = false; mobileMenuOpen = true; constructor( @@ -39,10 +39,10 @@ export class ApiDocsComponent implements OnInit { ); //to toggle fixed menu for desktop navigation - let that = this; + const that = this; window.addEventListener('scroll', function() { that.desktopDocsNavPosition = ( window.pageYOffset > 182 ) ? "fixed" : "relative"; - that.mobileDocsNavPosition = ( window.pageYOffset > 182 ) ? "fixed" : "relative"; + that.showFloatingDocsNav = ( window.pageYOffset > 1425 ) ? true : false; }); if (document.location.port !== '') { diff --git a/frontend/src/app/components/docs/docs.component.scss b/frontend/src/app/components/docs/docs.component.scss index 0f4b879eb..6398c5602 100644 --- a/frontend/src/app/components/docs/docs.component.scss +++ b/frontend/src/app/components/docs/docs.component.scss @@ -1,6 +1,7 @@ #main-tab-content { text-align: left; padding-top: 10px; + scroll-behavior: smooth; } #footer {