refactor start
This commit is contained in:
parent
bd49791e06
commit
e46d25f0b7
16699 changed files with 2 additions and 1484887 deletions
|
|
@ -1,46 +0,0 @@
|
|||
import options from "options"
|
||||
import { ButtonProps } from "types/widgets/button"
|
||||
|
||||
type PanelButtonProps = ButtonProps & {
|
||||
window?: string,
|
||||
flat?: boolean
|
||||
}
|
||||
|
||||
export default ({
|
||||
window = "",
|
||||
flat,
|
||||
child,
|
||||
setup,
|
||||
...rest
|
||||
}: PanelButtonProps) => Widget.Button({
|
||||
child: Widget.Box({ child }),
|
||||
setup: self => {
|
||||
let open = false
|
||||
|
||||
self.toggleClassName("panel-button")
|
||||
self.toggleClassName(window)
|
||||
|
||||
self.hook(options.bar.flatButtons, () => {
|
||||
self.toggleClassName("flat", flat ?? options.bar.flatButtons.value)
|
||||
})
|
||||
|
||||
self.hook(App, (_, win, visible) => {
|
||||
if (win !== window)
|
||||
return
|
||||
|
||||
if (open && !visible) {
|
||||
open = false
|
||||
self.toggleClassName("active", false)
|
||||
}
|
||||
|
||||
if (visible) {
|
||||
open = true
|
||||
self.toggleClassName("active")
|
||||
}
|
||||
})
|
||||
|
||||
if (setup)
|
||||
setup(self)
|
||||
},
|
||||
...rest,
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue