fix null not window error; don't add nulls when ternaries are wrong

This commit is contained in:
end-4
2024-04-29 18:59:06 +07:00
parent e401eb580a
commit bb75df9eb3
3 changed files with 12 additions and 11 deletions
@@ -50,12 +50,12 @@ export const ConfigToggle = ({
tooltipText: desc,
className: 'txt spacing-h-5 configtoggle-box',
children: [
(icon !== undefined ? MaterialIcon(icon, 'norm') : null),
(name !== undefined ? Label({
...(icon !== undefined ? [MaterialIcon(icon, 'norm')] : []),
...(name !== undefined ? [Label({
className: 'txt txt-small',
label: name,
}) : null),
expandWidget ? Box({ hexpand: true }) : null,
})] : []),
...(expandWidget ? [Box({ hexpand: true })] : []),
toggleButton,
]
});
@@ -203,12 +203,12 @@ export const ConfigSpinButton = ({
tooltipText: desc,
className: 'txt spacing-h-5 configtoggle-box',
children: [
(icon !== undefined ? MaterialIcon(icon, 'norm') : null),
(name !== undefined ? Label({
...(icon !== undefined ? [MaterialIcon(icon, 'norm')] : []),
...(name !== undefined ? [Label({
className: 'txt txt-small',
label: name,
}) : null),
expandWidget ? Box({ hexpand: true }) : null,
})] : []),
...(expandWidget ? [Box({ hexpand: true })] : []),
spinButton,
],
setup: (self) => {
@@ -106,7 +106,7 @@ const BluetoothDevices = () => Widget.Box({
tooltipText: device.name,
children: [
Widget.Icon(`${device.iconName}-symbolic`),
(device.batteryPercentage ? Widget.Label({
...(device.batteryPercentage ? [Widget.Label({
className: 'txt-smallie',
label: `${device.batteryPercentage}`,
setup: (self) => {
@@ -114,7 +114,7 @@ const BluetoothDevices = () => Widget.Box({
self.label = `${device.batteryPercentage}`;
}, 'notify::batteryPercentage')
}
}) : null),
})] : []),
]
});
});