Skip to content

Commit 28f884d

Browse files
fix prettier formatting
1 parent 4c04a8a commit 28f884d

22 files changed

+8794
-8525
lines changed

.prettierrc

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2-
"semi": false
2+
"trailingComma": "es5",
3+
"tabWidth": 4,
4+
"semi": false,
5+
"singleQuote": true
36
}

dialog_box.js

+43-40
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,56 @@
11
async function prompt(
2-
heading,
3-
body,
4-
buttons = ["Cancel", "Ok"],
5-
options = { title: heading, size: { width: 360, height: 280 } }
2+
heading,
3+
body,
4+
buttons = ['Cancel', 'Ok'],
5+
options = { title: heading, size: { width: 360, height: 280 } }
66
) {
7-
const [dlgEl, formEl, headingEl, dividerEl, bodyEl, footerEl] = [
8-
"dialog",
9-
"form",
10-
"sp-heading",
11-
"sp-divider",
12-
"sp-body",
13-
"footer",
14-
].map((tag) => document.createElement(tag))
15-
;[headingEl, dividerEl, bodyEl, footerEl].forEach((el) => {
16-
el.style.margin = "6px"
17-
el.style.width = "calc(100% - 12px)"
18-
})
7+
const [dlgEl, formEl, headingEl, dividerEl, bodyEl, footerEl] = [
8+
'dialog',
9+
'form',
10+
'sp-heading',
11+
'sp-divider',
12+
'sp-body',
13+
'footer',
14+
].map((tag) => document.createElement(tag))
15+
;[headingEl, dividerEl, bodyEl, footerEl].forEach((el) => {
16+
el.style.margin = '6px'
17+
el.style.width = 'calc(100% - 12px)'
18+
})
1919

20-
formEl.setAttribute("method", "dialog")
21-
formEl.addEventListener("submit", () => dlgEl.close())
20+
formEl.setAttribute('method', 'dialog')
21+
formEl.addEventListener('submit', () => dlgEl.close())
2222

23-
footerEl.style.marginTop = "26px"
23+
footerEl.style.marginTop = '26px'
2424

25-
dividerEl.setAttribute("size", "large")
25+
dividerEl.setAttribute('size', 'large')
2626

27-
headingEl.textContent = heading
27+
headingEl.textContent = heading
2828

29-
bodyEl.textContent = body
29+
bodyEl.textContent = body
3030

31-
buttons.forEach((btnText, idx) => {
32-
const btnEl = document.createElement("sp-button")
33-
btnEl.setAttribute(
34-
"variant",
35-
idx === buttons.length - 1 ? btnText.variant || "cta" : "secondary"
31+
buttons.forEach((btnText, idx) => {
32+
const btnEl = document.createElement('sp-button')
33+
btnEl.setAttribute(
34+
'variant',
35+
idx === buttons.length - 1 ? btnText.variant || 'cta' : 'secondary'
36+
)
37+
if (idx === buttons.length - 1)
38+
btnEl.setAttribute('autofocus', 'autofocus')
39+
if (idx < buttons.length - 1) btnEl.setAttribute('quiet')
40+
btnEl.textContent = btnText.text || btnText
41+
btnEl.style.marginLeft = '12px'
42+
btnEl.addEventListener('click', () =>
43+
dlgEl.close(btnText.text || btnText)
44+
)
45+
footerEl.appendChild(btnEl)
46+
})
47+
;[headingEl, dividerEl, bodyEl, footerEl].forEach((el) =>
48+
formEl.appendChild(el)
3649
)
37-
if (idx === buttons.length - 1) btnEl.setAttribute("autofocus", "autofocus")
38-
if (idx < buttons.length - 1) btnEl.setAttribute("quiet")
39-
btnEl.textContent = btnText.text || btnText
40-
btnEl.style.marginLeft = "12px"
41-
btnEl.addEventListener("click", () => dlgEl.close(btnText.text || btnText))
42-
footerEl.appendChild(btnEl)
43-
})
44-
;[headingEl, dividerEl, bodyEl, footerEl].forEach((el) =>
45-
formEl.appendChild(el)
46-
)
47-
dlgEl.appendChild(formEl)
48-
document.body.appendChild(dlgEl)
50+
dlgEl.appendChild(formEl)
51+
document.body.appendChild(dlgEl)
4952

50-
return dlgEl.uxpShowModal(options)
53+
return dlgEl.uxpShowModal(options)
5154
}
5255

5356
// const r1 = await prompt(

0 commit comments

Comments
 (0)