Added function on modal button
This commit is contained in:
parent
a31e7a59b3
commit
3022a084be
1 changed files with 6 additions and 1 deletions
|
|
@ -14,12 +14,16 @@ interface Props {
|
|||
width?: number
|
||||
wide?: boolean
|
||||
class?: string
|
||||
function?: () => Promise<void>
|
||||
}
|
||||
|
||||
export default (props: Props) => {
|
||||
const [isOpen, setIsOpen] = createSignal(false)
|
||||
|
||||
const openHandler = () => {
|
||||
const openHandler = async () => {
|
||||
if (props.function) {
|
||||
await props.function()
|
||||
}
|
||||
setIsOpen(true)
|
||||
}
|
||||
|
||||
|
|
@ -32,6 +36,7 @@ export default (props: Props) => {
|
|||
<Show when={!isOpen()}>
|
||||
<Button label={props.label} edges={props.edges} design={props.design} onClick={openHandler} />
|
||||
</Show>
|
||||
|
||||
<Show when={isOpen()}>
|
||||
<div class="modal" onClick={closeHandler}>
|
||||
<Show when={props.border}>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue