From c9c5b5b5b61fd41b3c3507d6488c960aac776e2b Mon Sep 17 00:00:00 2001 From: Catalina Oyaneder Date: Tue, 11 Jun 2024 07:47:55 +0100 Subject: [PATCH] refactor: remove Community Examples tab layout --- infrastructure/code/template/details.html | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/infrastructure/code/template/details.html b/infrastructure/code/template/details.html index 24f381363..edb868677 100644 --- a/infrastructure/code/template/details.html +++ b/infrastructure/code/template/details.html @@ -75,8 +75,7 @@ .issue-overview-header, .ignore-details-header, .data-flow-header, - .ai-fix-header, - .example-fixes-header { + .ai-fix-header { line-height: 1.25rem; } @@ -202,7 +201,6 @@ } .main-tabs-nav, - .example-fixes-tabs-nav, .tabs-nav { display: flex; list-style-type: none; @@ -909,9 +907,6 @@

Fixed Code Examples

const MAIN_TAB_NAV_SELECTOR = '.main-tabs-nav'; const MAIN_TAB_ITEM_SELECTOR = '.main-tabs-nav .tab-item'; const MAIN_TAB_CONTENT_SELECTOR = '.tab-container > .main-tab-content'; - const EXAMPLE_TAB_NAV_SELECTOR = '.example-fixes-tabs-nav'; - const EXAMPLE_TAB_ITEM_SELECTOR = '.example-fixes-tabs-nav .tab-item'; - const EXAMPLE_TAB_CONTENT_SELECTOR = '.tab-container > .example-fix-tab-content'; const toggleIsSelectedClass = (elements, shouldToggle) => { elements.forEach(el => { @@ -924,9 +919,6 @@

Fixed Code Examples

document.addEventListener('DOMContentLoaded', () => { const mainTabLinks = document.querySelectorAll(MAIN_TAB_ITEM_SELECTOR); const mainTabContents = document.querySelectorAll(MAIN_TAB_CONTENT_SELECTOR); - // Nested tabs - const exampleTabLinks = document.querySelectorAll(EXAMPLE_TAB_ITEM_SELECTOR); - const exampleTabContents = document.querySelectorAll(EXAMPLE_TAB_CONTENT_SELECTOR); const onMainTabClicked = event => { const clickedTab = event.target.closest('.tab-item'); @@ -939,19 +931,9 @@

Fixed Code Examples

toggleIsSelectedClass(mainTabContents, content => content.getAttribute('data-content') === selectedTab); }; - const onExampleTabClicked = event => { - const clickedTab = event.target.closest('.tab-item'); - if (!clickedTab) return; - - const targetContentId = clickedTab.id.replace('tab-link-', 'tab-content-'); - toggleIsSelectedClass(exampleTabLinks, tab => tab === clickedTab); - toggleIsSelectedClass(exampleTabContents, content => content.id === targetContentId); - }; - - // Event listeners for main and nested tabs + // Event listeners for main // TODO: move this into the HTML as an onclick document.querySelector(MAIN_TAB_NAV_SELECTOR).addEventListener('click', onMainTabClicked); - document.querySelector(EXAMPLE_TAB_NAV_SELECTOR)?.addEventListener('click', onExampleTabClicked); });