Skip to content

Commit

Permalink
Minor fixes with the new close tab prompts
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioCasCeb committed Oct 13, 2023
1 parent 2224de1 commit 3fc9287
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/web-new/src/scripts/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import { clearConsole } from './console'
const addTab = document.querySelector(".ide__tabs__add")
const tabsLeftContainer = document.querySelector(".ide__tabs__left")
const ideContainer = document.querySelector(".ide__container")
let tabsLeft = document.querySelectorAll(".ide__tabs__left li:not(:last-child)")
export let tabsLeft = document.querySelectorAll(".ide__tabs__left li:not(:last-child)")

//Editor list array where all the generated editor will be added and referenced from
export let editorList = []
Expand Down
22 changes: 20 additions & 2 deletions packages/web-new/src/scripts/examples-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* In the future the option to see short snipets of the most important part of the example, might also be implemented.
*/

import { createIde, ideCount } from "./editor"
import { createIde, ideCount, tabsLeft } from "./editor"

/***********************************************************/
/* Examples menu */
Expand Down Expand Up @@ -311,6 +311,9 @@ async function getAllExamples(categoryId, thingType) {
quickButton.addEventListener('click', () => {
getTemplateData(example[1]["path"])
closeCards()
tabsLeft.forEach(tab => {
tab.children[3].classList.add("hidden")
})
})

//create example content
Expand Down Expand Up @@ -352,6 +355,9 @@ async function getAllExamples(categoryId, thingType) {
exampleBtnUse.addEventListener('click', () => {
getTemplateData(example[1]["path"])
closeCards()
tabsLeft.forEach(tab => {
tab.children[3].classList.add("hidden")
})
})

//Listener to generate an editor with the examples information
Expand Down Expand Up @@ -411,11 +417,17 @@ filterForm.addEventListener("submit", (e) => {
clonedElement.children[0].children[1].addEventListener('click', () => {
example.querySelector(".example__btn--use").click()
closeCards()
tabsLeft.forEach(tab => {
tab.children[3].classList.add("hidden")
})
})
//Opening the example when clicking on the apply button
clonedElement.querySelector(".example__btn--use").addEventListener('click', () => {
example.querySelector(".example__btn--use").click()
closeCards()
tabsLeft.forEach(tab => {
tab.children[3].classList.add("hidden")
})
})
//Closing the card when clicking on the cancel btn
clonedElement.querySelector(".example__btn--cancel").addEventListener('click', () => {
Expand Down Expand Up @@ -450,15 +462,21 @@ filterForm.addEventListener("submit", (e) => {
clonedElement.children[0].children[0].addEventListener('click', () => {
clonedElement.classList.toggle("open")
})
//Opning the example when clicking on the quick access button
//Opening the example when clicking on the quick access button
clonedElement.children[0].children[1].addEventListener('click', () => {
example.querySelector(".example__btn--use").click()
closeCards()
tabsLeft.forEach(tab => {
tab.children[3].classList.add("hidden")
})
})
//Opening the example when clicking on the apply button
clonedElement.querySelector(".example__btn--use").addEventListener('click', () => {
example.querySelector(".example__btn--use").click()
closeCards()
tabsLeft.forEach(tab => {
tab.children[3].classList.add("hidden")
})
})
//Closing the card when clicking on the cancel btn
clonedElement.querySelector(".example__btn--cancel").addEventListener('click', () => {
Expand Down

0 comments on commit 3fc9287

Please sign in to comment.