I am using a library that has a specific object structure and it looks like this:
const libraryTemplateData = [
{
eventContainerStyle: {
style: {
opacity: 1,
},
},
title: {
content: "Title Item #1",
},
description: {
content: "Description Item #2",
},
time: {
content: "Time Item #2",
style: { opacity: 1 },
},
icon: {
style: {
opacity: 1,
},
},
},
{
title: {
content: "Title Item #2",
},
description: {
content: "Description Item #2",
},
time: {
content: "Time Item #2",
},
},
{
title: {
content: "Title Item #3",
},
description: {
content: "Description #3",
},
time: {
content: "Time Item #3",
},
},
and so on..
I also have a data that I receive from API call (can't restructure it on a DB level to match the libraryTemplateData):
{
"data": [
{
"ID": "59732379",
"TIME": "16:00",
"TITLE": "Item Title #1",
"DESCRIPTION": "Description Item #1"
},
{
"ID": "59732361",
"TIME": "18:00",
"TITLE": "Title Item #2",
"DESCRIPTION": "Description Item #2"
}
],
"result": 0,
"resultdescription": "OK"
}
and so on..
How to map data to the type of object in libraryTemplateData? I also need to change the properties in data[0] as you can see in libraryTemplateData[0]. The opacity has to be set to achieve the "light up" effect. All elements after data[0] will be opacity:0 by default.