-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(dynamic): refactor structure and add dynamic example #125
- Loading branch information
1 parent
02f809c
commit 1e7551e
Showing
17 changed files
with
202 additions
and
448 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
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<auro-radio-group required id="dynamicExample"> | ||
<span slot="legend">Form label goes here</span> | ||
</auro-radio-group> |
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,16 @@ | ||
export function dynamicExample() { | ||
const values = ['Yes', 'No', 'Maybe']; | ||
const radioGroup = document.getElementById('dynamicExample'); | ||
|
||
for (let i = 0; i < values.length; i++) { | ||
const radio = document.createElement('auro-radio'); | ||
|
||
radio.id = `radio${i}`; | ||
radio.label = values[i]; | ||
radio.name = 'radioDemo'; | ||
radio.value = values[i]; | ||
radio.textContent = values[i]; | ||
|
||
radioGroup.appendChild(radio); | ||
} | ||
} |
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,6 @@ | ||
<auro-radio-group> | ||
<auro-radio-group error="There is an error with this form entry"> | ||
<span slot="legend">Form label goes here</span> | ||
<auro-radio id="radio16" label="Yes" name="radioDemo" value="yes"></auro-radio> | ||
<auro-radio id="radio17" label="No" name="radioDemo" value="no" error></auro-radio> | ||
<auro-radio id="radio18" label="Maybe" name="radioDemo" value="maybe"></auro-radio> | ||
<auro-radio id="radio19" label="Yes" name="radioDemo" value="yes"></auro-radio> | ||
<auro-radio id="radio20" label="No" name="radioDemo" value="no"></auro-radio> | ||
<auro-radio id="radio21" label="Maybe" name="radioDemo" value="maybe"></auro-radio> | ||
</auro-radio-group> |
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,16 @@ | ||
import { dynamicExample } from "../apiExamples/dynamic"; | ||
|
||
export function initExamples(initCount) { | ||
initCount = initCount || 0; | ||
|
||
try { | ||
dynamicExample(); | ||
} catch (error) { | ||
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,33 @@ | ||
function dynamicExample() { | ||
const values = ['Yes', 'No', 'Maybe']; | ||
const radioGroup = document.getElementById('dynamicExample'); | ||
|
||
for (let i = 0; i < values.length; i++) { | ||
const radio = document.createElement('auro-radio'); | ||
|
||
radio.id = `radio${i}`; | ||
radio.label = values[i]; | ||
radio.name = 'radioDemo'; | ||
radio.value = values[i]; | ||
radio.textContent = values[i]; | ||
|
||
radioGroup.appendChild(radio); | ||
} | ||
} | ||
|
||
function initExamples(initCount) { | ||
initCount = initCount || 0; | ||
|
||
try { | ||
dynamicExample(); | ||
} catch (error) { | ||
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 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.