Hi,
I’m trying to add an oh-label-item component to a list that would change it’s icon and text based on the item it displays.
So far, I have two separte labels displaying power grid draw and supply, but as they are mutually exclusive I would rather display one label that switches it’s state depending on the values.
These are my two labels I currently have.
- component: oh-label-item
config:
icon: iconify:akar-icons:arrow-back-thick-fill
iconColor: red
item: =props.senecHomeGridDrawItem
style:
--f7-list-item-after-font-size: 15px
--f7-list-item-after-text-color: "=themeOptions.dark === 'dark' ? 'rgb(180,180,180)' : 'rgb(100,100,100)'"
--f7-list-item-title-font-size: 15px
--f7-list-item-title-text-color: "=themeOptions.dark === 'dark' ? 'rgb(180,180,180)' : 'rgb(100,100,100)'"
title: =props.senecHomeGridDrawItemTitle
- component: oh-label-item
config:
icon: iconify:akar-icons:arrow-forward-thick-fill
iconColor: green
item: =props.senecHomeGridSupplyItem
style:
--f7-list-item-after-font-size: 15px
--f7-list-item-after-text-color: "=themeOptions.dark === 'dark' ? 'rgb(180,180,180)' : 'rgb(100,100,100)'"
--f7-list-item-title-font-size: 15px
--f7-list-item-title-text-color: "=themeOptions.dark === 'dark' ? 'rgb(180,180,180)' : 'rgb(100,100,100)'"
title: =props.senecHomeGridSupplyItemTitle
I tried to combine them in the following way without success:
- component: oh-label-item
config:
icon: '=(items[props.senecHomeGridSupplyItem] > 0) ? "iconify:akar-icons:arrow-forward-thick-fill" : "iconify:akar-icons:arrow-back-thick-fill"'
iconColor: '=(items[props.senecHomeGridSupplyItem] > 0) ? "green" : "red"'
item: =props.senecHomeGridSupplyItem
style:
--f7-list-item-after-font-size: 15px
--f7-list-item-after-text-color: "=themeOptions.dark === 'dark' ? 'rgb(180,180,180)' : 'rgb(100,100,100)'"
--f7-list-item-title-font-size: 15px
--f7-list-item-title-text-color: "=themeOptions.dark === 'dark' ? 'rgb(180,180,180)' : 'rgb(100,100,100)'"
title: '=(items[props.senecHomeGridSupplyItem] > 0) ? =(items[senecHomeGridSupplyItemTitle]) : =(items[senecHomeGridDrawItemTitle])'
These are my problems:
- I can’t find a working syntax for the item (value) definition to display either the value from
=props.senecHomeGridSupplyItem
or=props.senecHomeGridDrawItem
depending on the value of=props.senecHomeGridSupplyItem
being > 0 - The tite is displayed as undefined and not changing as exptected
- Icon and icon color are not changing as expected
Can someone advise?