diff options
| author | Ja.KooLit <jimmielovejay@gmail.com> | 2024-05-04 15:42:48 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-04 15:42:48 +0900 |
| commit | 1127bae8815e1b60b637d0c88832bddae7cc5a1a (patch) | |
| tree | 2501119e4914f79535e5bd1e12d64fc6754337c6 /config/ags/modules/overview/searchitem.js | |
| parent | 5e304d31a220a64338e5cb84e397d1a102855260 (diff) | |
| parent | dc9f0cd58454b4cb33a704b11e4cc8a7c6594e67 (diff) | |
Merge pull request #231 from SherLock707/dev_overview
Added ags overview widget
Diffstat (limited to 'config/ags/modules/overview/searchitem.js')
| -rw-r--r-- | config/ags/modules/overview/searchitem.js | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/config/ags/modules/overview/searchitem.js b/config/ags/modules/overview/searchitem.js new file mode 100644 index 00000000..2a3303a4 --- /dev/null +++ b/config/ags/modules/overview/searchitem.js @@ -0,0 +1,65 @@ +import Widget from 'resource:///com/github/Aylur/ags/widget.js'; + +export const searchItem = ({ materialIconName, name, actionName, content, onActivate, extraClassName = '', ...rest }) => { + const actionText = Widget.Revealer({ + revealChild: false, + transition: "crossfade", + transitionDuration: userOptions.animations.durationLarge, + child: Widget.Label({ + className: 'overview-search-results-txt txt txt-small txt-action', + label: `${actionName}`, + }) + }); + const actionTextRevealer = Widget.Revealer({ + revealChild: false, + transition: "slide_left", + transitionDuration: userOptions.animations.durationSmall, + child: actionText, + }) + return Widget.Button({ + className: `overview-search-result-btn txt ${extraClassName}`, + onClicked: onActivate, + child: Widget.Box({ + children: [ + Widget.Box({ + vertical: false, + children: [ + Widget.Label({ + className: `icon-material overview-search-results-icon`, + label: `${materialIconName}`, + }), + Widget.Box({ + vertical: true, + children: [ + Widget.Label({ + hpack: 'start', + className: 'overview-search-results-txt txt-smallie txt-subtext', + label: `${name}`, + truncate: "end", + }), + Widget.Label({ + hpack: 'start', + className: 'overview-search-results-txt txt-norm', + label: `${content}`, + truncate: "end", + }), + ] + }), + Widget.Box({ hexpand: true }), + actionTextRevealer, + ], + }) + ] + }), + setup: (self) => self + .on('focus-in-event', (button) => { + actionText.revealChild = true; + actionTextRevealer.revealChild = true; + }) + .on('focus-out-event', (button) => { + actionText.revealChild = false; + actionTextRevealer.revealChild = false; + }) + , + }); +} |
