This commit is contained in:
parent
f39b8439c0
commit
8d41998929
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
const loadSection = (sectionName) =>{
|
const loadSection = (sectionName) => {
|
||||||
fetch(`data/${sectionName}.json`)
|
fetch(`data/${sectionName}.json`)
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
@ -11,7 +11,7 @@ const loadSection = (sectionName) =>{
|
|||||||
|
|
||||||
function cap(str) {
|
function cap(str) {
|
||||||
return str.charAt(0).toUpperCase() + str.slice(1);
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recursive function to handle strings, arrays, and objects
|
// Recursive function to handle strings, arrays, and objects
|
||||||
const renderItems = (items) => {
|
const renderItems = (items) => {
|
||||||
@ -28,11 +28,11 @@ const renderItems = (items) => {
|
|||||||
return `<p>${String(item)}</p>`;
|
return `<p>${String(item)}</p>`;
|
||||||
}
|
}
|
||||||
}).join('');
|
}).join('');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const sections = document.getElementsByClassName('section')
|
const sections = document.getElementsByClassName('section')
|
||||||
Array.from(sections).forEach(section =>{
|
Array.from(sections).forEach(section => {
|
||||||
loadSection(section.id)
|
loadSection(section.id)
|
||||||
})
|
})
|
Loading…
Reference in New Issue
Block a user