From 4b8d3e823fa801d4655c2eb6d6408dcbb57c1773 Mon Sep 17 00:00:00 2001 From: George J Padayatti Date: Mon, 25 Sep 2023 20:06:04 +0530 Subject: [PATCH] Fix: Revert to sidebar in rapidocs Signed-off-by: George J Padayatti --- openapi/v2023.8.1/index.html | 93 +++++++++++++++++------------------- openapi/v2023.8.2/index.html | 93 +++++++++++++++++------------------- 2 files changed, 88 insertions(+), 98 deletions(-) diff --git a/openapi/v2023.8.1/index.html b/openapi/v2023.8.1/index.html index 80f1e7a..52a04e4 100644 --- a/openapi/v2023.8.1/index.html +++ b/openapi/v2023.8.1/index.html @@ -3,8 +3,8 @@ - - GovStack Consent Building Block APIs + + GovStack Consent BB APIs { const rapiDocElement = document.querySelector("rapi-doc"); - // Function to apply the style when the element is available - const applyStyleToApiInfo = () => { - const header = - rapiDocElement.shadowRoot.querySelector(".main-header"); - const mainContentElement = - rapiDocElement.shadowRoot.querySelector(".main-content"); - const apiInfoElement = - rapiDocElement.shadowRoot.querySelector("#api-info"); - const labelOperationPathElements = - rapiDocElement.shadowRoot.querySelectorAll( - "[part*='section-operation-webhook-method']" - ); + if (window.innerWidth <= 768) { + // Assuming 768px as the breakpoint for tablet size + rapiDocElement.setAttribute("render-style", "read"); // for sizes less than a tablet + + // Function to apply the style when the element is available + const applyStyleToApiInfo = () => { + const mainContentElement = + rapiDocElement.shadowRoot.querySelector(".main-content"); + const apiInfoElement = + rapiDocElement.shadowRoot.querySelector("#api-info"); + const labelOperationPathElements = + rapiDocElement.shadowRoot.querySelectorAll( + "[part*='section-operation-webhook-method']" + ); + + if ( + apiInfoElement && + labelOperationPathElements && + mainContentElement + ) { + mainContentElement.style.padding = "10px"; + apiInfoElement.style.marginLeft = "0"; + labelOperationPathElements.forEach(function (element) { + element.style.overflowX = "scroll"; + }); + observer.disconnect(); // Stop observing once style is applied + } + }; - if ( - apiInfoElement && - labelOperationPathElements && - mainContentElement && - header - ) { - mainContentElement.style.padding = "10px"; - apiInfoElement.style.marginLeft = "0"; - header.style.padding = "8px 4px 8px 16px"; - labelOperationPathElements.forEach(function (element) { - element.style.overflowX = "scroll"; + // Observe changes in the Shadow DOM + const observer = new MutationObserver(applyStyleToApiInfo); + if (rapiDocElement.shadowRoot) { + observer.observe(rapiDocElement.shadowRoot, { + childList: true, + subtree: true, }); - observer.disconnect(); // Stop observing once style is applied + applyStyleToApiInfo(); // Try applying the style immediately in case the element is already there } - }; - - // Observe changes in the Shadow DOM - const observer = new MutationObserver(applyStyleToApiInfo); - if (rapiDocElement.shadowRoot) { - observer.observe(rapiDocElement.shadowRoot, { - childList: true, - subtree: true, - }); - applyStyleToApiInfo(); // Try applying the style immediately in case the element is already there - } - if (window.innerWidth <= 768) { - // Assuming 768px as the breakpoint for tablet size - rapiDocElement.setAttribute("render-style", "view"); // for sizes less than a tablet } else { - rapiDocElement.setAttribute("render-style", "view"); // for sizes greater than a tablet + rapiDocElement.setAttribute("render-style", "focused"); // for sizes greater than a tablet } }); - + \ No newline at end of file diff --git a/openapi/v2023.8.2/index.html b/openapi/v2023.8.2/index.html index 80f1e7a..52a04e4 100644 --- a/openapi/v2023.8.2/index.html +++ b/openapi/v2023.8.2/index.html @@ -3,8 +3,8 @@ - - GovStack Consent Building Block APIs + + GovStack Consent BB APIs { const rapiDocElement = document.querySelector("rapi-doc"); - // Function to apply the style when the element is available - const applyStyleToApiInfo = () => { - const header = - rapiDocElement.shadowRoot.querySelector(".main-header"); - const mainContentElement = - rapiDocElement.shadowRoot.querySelector(".main-content"); - const apiInfoElement = - rapiDocElement.shadowRoot.querySelector("#api-info"); - const labelOperationPathElements = - rapiDocElement.shadowRoot.querySelectorAll( - "[part*='section-operation-webhook-method']" - ); + if (window.innerWidth <= 768) { + // Assuming 768px as the breakpoint for tablet size + rapiDocElement.setAttribute("render-style", "read"); // for sizes less than a tablet + + // Function to apply the style when the element is available + const applyStyleToApiInfo = () => { + const mainContentElement = + rapiDocElement.shadowRoot.querySelector(".main-content"); + const apiInfoElement = + rapiDocElement.shadowRoot.querySelector("#api-info"); + const labelOperationPathElements = + rapiDocElement.shadowRoot.querySelectorAll( + "[part*='section-operation-webhook-method']" + ); + + if ( + apiInfoElement && + labelOperationPathElements && + mainContentElement + ) { + mainContentElement.style.padding = "10px"; + apiInfoElement.style.marginLeft = "0"; + labelOperationPathElements.forEach(function (element) { + element.style.overflowX = "scroll"; + }); + observer.disconnect(); // Stop observing once style is applied + } + }; - if ( - apiInfoElement && - labelOperationPathElements && - mainContentElement && - header - ) { - mainContentElement.style.padding = "10px"; - apiInfoElement.style.marginLeft = "0"; - header.style.padding = "8px 4px 8px 16px"; - labelOperationPathElements.forEach(function (element) { - element.style.overflowX = "scroll"; + // Observe changes in the Shadow DOM + const observer = new MutationObserver(applyStyleToApiInfo); + if (rapiDocElement.shadowRoot) { + observer.observe(rapiDocElement.shadowRoot, { + childList: true, + subtree: true, }); - observer.disconnect(); // Stop observing once style is applied + applyStyleToApiInfo(); // Try applying the style immediately in case the element is already there } - }; - - // Observe changes in the Shadow DOM - const observer = new MutationObserver(applyStyleToApiInfo); - if (rapiDocElement.shadowRoot) { - observer.observe(rapiDocElement.shadowRoot, { - childList: true, - subtree: true, - }); - applyStyleToApiInfo(); // Try applying the style immediately in case the element is already there - } - if (window.innerWidth <= 768) { - // Assuming 768px as the breakpoint for tablet size - rapiDocElement.setAttribute("render-style", "view"); // for sizes less than a tablet } else { - rapiDocElement.setAttribute("render-style", "view"); // for sizes greater than a tablet + rapiDocElement.setAttribute("render-style", "focused"); // for sizes greater than a tablet } }); - + \ No newline at end of file