Skip to content

Commit

Permalink
export connectModal as function
Browse files Browse the repository at this point in the history
  • Loading branch information
sameoldlab committed Jul 31, 2024
1 parent fe9a853 commit ed4d08e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions packages/ui/src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
import ConnectModal from './ConnectModal/ConnectModal.svelte'
import AccountModal from './AccountModal.svelte'
import FractlModal from './FractlModal.svelte'
import type { Config } from '@fractl-ui/types'

export const create = async <C extends object>(config: Promise<Config<C>>) => {
let _config = await Promise.resolve(config)

return () => {
const getTarget = () => document.body

return new Promise((resolve, reject) => {
new ConnectModal({
target: getTarget(),
props: {
config: _config,
state: _config.state
}
})
})
}
}
export { ConnectModal, AccountModal, FractlModal }
2 changes: 1 addition & 1 deletion packages/ui/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export { FractlModal } from './components/index.js'
export { create } from './components/index.js'
// export {open connect modal}
// export T&C text prop

0 comments on commit ed4d08e

Please sign in to comment.