You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
OneAuth/oaer/lib/components/slide.ts

81 lines
1.7 KiB
TypeScript

1 month ago
/*
* slide.ts
* Copyright (C) 2024 veypi <i@veypi.com>
* 2024-10-22 17:57
* Distributed under terms of the GPL license.
*/
import v from './v2dom'
1 month ago
import bus from '../bus'
import account from './account'
import app from './app'
1 month ago
/*
mask
slide
header
body
main
footer
*
* */
export default class {
mask: HTMLElement
slide: HTMLElement
header: HTMLElement
1 month ago
body: HTMLElement
main: HTMLElement
footer: HTMLElement
constructor() {
this.header = v({
class: 'voa-slide-header voa-animate-slow',
1 month ago
})
this.footer = v({
class: 'voa-slide-footer',
1 month ago
innerHtml: 'logout',
onclick: () => {
bus.emit('logout')
}
})
this.main = v({
class: 'voa-slide-main',
children: [
1 month ago
account,
v({ class: 'voa-sm-separate' }),
app,
v({ class: 'voa-sm-separate' })
]
1 month ago
})
this.body = v({
class: 'voa-slide-body voa-animate-slow',
1 month ago
style: 'animation-delay: 300ms',
children: [this.main, this.footer]
})
this.slide = v({
1 month ago
id: 'voa-slide',
class: 'voa-slide',
1 month ago
children: [this.header, this.body]
})
this.mask = v({
class: 'voa-slide-mask',
1 month ago
style: 'visibility: hidden',
children: [this.slide],
onclick: (e: MouseEvent) => {
if (e.target === e.currentTarget) {
this.hide()
}
}
})
document.body.appendChild(this.mask)
}
show() {
this.mask.style.visibility = 'visible'
this.header.classList.add('voa-slidein-right')
this.body.classList.add('voa-slidein-up')
1 month ago
}
hide() {
this.mask.style.visibility = 'hidden'
this.header.classList.remove('voa-slidein-right')
this.body.classList.remove('voa-slidein-up')
1 month ago
}
}