mirror of
https://github.com/eosswedenorg/apt
synced 2026-06-16 04:34:56 +02:00
Adding assets/js/modules/alpine_collapse.js
This commit is contained in:
parent
56c375f4d1
commit
648fa04d0a
3 changed files with 21 additions and 1 deletions
|
|
@ -3,6 +3,7 @@ import $ from 'jquery'
|
|||
import AnchorJS from 'anchor-js'
|
||||
import Alpine from 'alpinejs'
|
||||
import alpine_search from './modules/alpine_search'
|
||||
import alpine_collapse from './modules/alpine_collapse'
|
||||
import ClipboardJS from 'clipboard'
|
||||
import tippy from 'tippy.js'
|
||||
|
||||
|
|
@ -17,6 +18,7 @@ anchors.add();
|
|||
// Alpine
|
||||
// ------------------------------------------
|
||||
|
||||
Alpine.data('collapse', alpine_collapse)
|
||||
Alpine.data('searchComponent', alpine_search)
|
||||
Alpine.start()
|
||||
|
||||
|
|
|
|||
18
assets/js/modules/alpine_collapse.js
Normal file
18
assets/js/modules/alpine_collapse.js
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
|
||||
// Alpine collapse component
|
||||
export default () => ({
|
||||
show: false,
|
||||
trigger: {
|
||||
['@click']() {
|
||||
this.show = ! this.show;
|
||||
},
|
||||
['x-text']() {
|
||||
return this.show ? 'Hide' : 'Show';
|
||||
}
|
||||
},
|
||||
target: {
|
||||
['x-show']() {
|
||||
return this.show;
|
||||
}
|
||||
}
|
||||
})
|
||||
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue