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