Files
custum-hyprpanel/modules/shared/barItemBox.ts
Jas Singh 2c72cc66d8 Implemented strict linting standards and prettier formatting config. (#248)
* Implemented strict linting standards and prettier formatting config.

* More linter fixes and type updates.

* More linter updates and type fixes

* Remove noisy comments

* Linter and type updates

* Linter, formatting and type updates.

* Linter updates

* Type updates

* Type updates

* fixed all linter errors

* Fixed all linting, formatting and type issues.

* Resolve merge conflicts.
2024-09-14 16:20:05 -07:00

33 lines
1.0 KiB
TypeScript

import { BarBoxChild } from 'lib/types/bar';
import { Bind } from 'lib/types/variable';
import { Attribute, GtkWidget } from 'lib/types/widget';
import options from 'options';
import Button from 'types/widgets/button';
export const BarItemBox = (child: BarBoxChild): Button<GtkWidget, Attribute> => {
const computeVisible = (): Bind | boolean => {
if (child.isVis !== undefined) {
return child.isVis.bind('value');
}
return child.isVisible;
};
return Widget.Button({
class_name: options.theme.bar.buttons.style.bind('value').as((style) => {
const styleMap = {
default: 'style1',
split: 'style2',
wave: 'style3',
wave2: 'style4',
};
const boxClassName = Object.hasOwnProperty.call(child, 'boxClass') ? child.boxClass : '';
return `bar_item_box_visible ${styleMap[style]} ${boxClassName}`;
}),
child: child.component,
visible: computeVisible(),
...child.props,
});
};