Files
qwqcode dcde53f8ad refactor(ui/auth): ensure compatibility with new client types (#1009)
- 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)
2024-10-18 17:09:15 +08:00

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,
}
}