-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(docs): refactor the JS examples
- Loading branch information
1 parent
a82504e
commit a7aed9c
Showing
18 changed files
with
247 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<custom-dropdown aria-label="custom label"> | ||
Lorem ipsum solar | ||
<div slot="trigger"> | ||
Trigger | ||
</div> | ||
</custom-dropdown> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export function hideExample() { | ||
const btn = document.querySelector('#hideExampleBtn'); | ||
const dropdown = document.querySelector('#hideExample'); | ||
|
||
btn.addEventListener('click', () => { | ||
dropdown.hide(); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
export function showExample(elem) { | ||
const triggerInput = document.querySelector('#showExampleTriggerInput') | ||
export function showExample() { | ||
const triggerInput = document.querySelector('#showExampleTriggerInput'); | ||
const dropdownElem = document.querySelector('#showMethodExample'); | ||
|
||
triggerInput.addEventListener('keydown', () => { | ||
elem.show(); | ||
}) | ||
dropdownElem.show(); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* eslint-disable jsdoc/require-jsdoc, no-magic-numbers, no-param-reassign */ | ||
|
||
import { showExample } from './../apiExamples/programmaticallyShow.js'; | ||
import { hideExample } from './../apiExamples/programmaticallyHide.js'; | ||
|
||
export function initExamples(initCount) { | ||
initCount = initCount || 0; | ||
|
||
try { | ||
// javascript example function calls to be added here upon creation to test examples | ||
showExample(); | ||
hideExample(); | ||
} catch (err) { | ||
if (initCount <= 20) { | ||
// setTimeout handles issue where content is sometimes loaded after the functions get called | ||
setTimeout(() => { | ||
initExamples(initCount + 1); | ||
}, 100); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
function showExample() { | ||
const triggerInput = document.querySelector('#showExampleTriggerInput'); | ||
const dropdownElem = document.querySelector('#showMethodExample'); | ||
|
||
triggerInput.addEventListener('keydown', () => { | ||
dropdownElem.show(); | ||
}); | ||
} | ||
|
||
function hideExample() { | ||
const btn = document.querySelector('#hideExampleBtn'); | ||
const dropdown = document.querySelector('#hideExample'); | ||
|
||
btn.addEventListener('click', () => { | ||
dropdown.hide(); | ||
}); | ||
} | ||
|
||
/* eslint-disable jsdoc/require-jsdoc, no-magic-numbers, no-param-reassign */ | ||
|
||
|
||
function initExamples(initCount) { | ||
initCount = initCount || 0; | ||
|
||
try { | ||
// javascript example function calls to be added here upon creation to test examples | ||
showExample(); | ||
hideExample(); | ||
} catch (err) { | ||
if (initCount <= 20) { | ||
// setTimeout handles issue where content is sometimes loaded after the functions get called | ||
setTimeout(() => { | ||
initExamples(initCount + 1); | ||
}, 100); | ||
} | ||
} | ||
} | ||
|
||
export { initExamples }; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* eslint-disable jsdoc/require-jsdoc, no-magic-numbers, no-param-reassign */ | ||
|
||
// import { auroMenuResetExample } from '../apiExamples/reset'; | ||
|
||
export function initExamples(initCount) { | ||
initCount = initCount || 0; | ||
|
||
try { | ||
// javascript example function calls to be added here upon creation to test examples | ||
// auroMenuResetExample(); | ||
} catch (err) { | ||
if (initCount <= 20) { | ||
// setTimeout handles issue where content is sometimes loaded after the functions get called | ||
setTimeout(() => { | ||
initExamples(initCount + 1); | ||
}, 100); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* eslint-disable jsdoc/require-jsdoc, no-magic-numbers, no-param-reassign */ | ||
|
||
// import { auroMenuResetExample } from '../apiExamples/reset'; | ||
|
||
function initExamples(initCount) { | ||
} | ||
|
||
export { initExamples }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.