Refactor: messageBox
This commit is contained in:
parent
f070d7ff8e
commit
137198e951
|
@ -69,21 +69,12 @@ function messageBox({
|
||||||
onclick: messageBox.listeners.closeIcon}),
|
onclick: messageBox.listeners.closeIcon}),
|
||||||
$element({id: `${id}-contents`, appendChild: tHTML(contents)}),
|
$element({id: `${id}-contents`, appendChild: tHTML(contents)}),
|
||||||
$element({id: `${id}-buttons`, appendChild:
|
$element({id: `${id}-buttons`, appendChild:
|
||||||
buttons.map((textContent, buttonIndex) => {
|
buttons.map((content, buttonIndex) => content && $element({
|
||||||
if (!textContent) {
|
tag: 'button',
|
||||||
return;
|
buttonIndex,
|
||||||
}
|
textContent: content.textContent || content,
|
||||||
let onclick = messageBox.listeners.button;
|
onclick: content.onclick || messageBox.listeners.button,
|
||||||
if (typeof textContent === 'object') {
|
}))
|
||||||
({onclick = onclick, textContent} = textContent);
|
|
||||||
}
|
|
||||||
return $element({
|
|
||||||
tag: 'button',
|
|
||||||
buttonIndex,
|
|
||||||
textContent,
|
|
||||||
onclick,
|
|
||||||
});
|
|
||||||
})
|
|
||||||
}),
|
}),
|
||||||
]}),
|
]}),
|
||||||
]});
|
]});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user