- Bump to new Artalk client export types - Add `AuthContext` type definition for improved clarity - Replace `ContextApi` with `AuthContext` for reducing the scope of variables - Bump version to 0.0.2 for release (The prerequisite PR is #1007)
20 lines
472 B
TypeScript
20 lines
472 B
TypeScript
import { JSX } from 'solid-js'
|
|
import { render } from 'solid-js/web'
|
|
import type { Layer } from 'artalk'
|
|
import type { AuthContext } from '../types'
|
|
|
|
export const createLayer = (ctx: AuthContext) => {
|
|
const layer = ctx.getLayers().create('login')
|
|
const show = (el: (l: Layer) => JSX.Element) => {
|
|
const $el = document.createElement('div')
|
|
render(() => el(layer), $el)
|
|
layer.getEl().append($el.firstChild!)
|
|
|
|
layer.show()
|
|
}
|
|
|
|
return {
|
|
show,
|
|
}
|
|
}
|