2022-06-09 17:30:40 +02:00
|
|
|
import { SFrame, _ } from "../../main.js";
|
|
|
|
import { fadein, fadeout } from "../../utils.js";
|
|
|
|
|
|
|
|
const preRender = false;
|
|
|
|
|
|
|
|
const render = ({ }, {titel,text,callback}) => {
|
|
|
|
|
|
|
|
return _({
|
|
|
|
find:"main",
|
2022-06-09 21:37:23 +02:00
|
|
|
class:"stear_alert",
|
2022-06-09 17:30:40 +02:00
|
|
|
style: {
|
|
|
|
position:"fixed",
|
|
|
|
left: "0",
|
|
|
|
top: "0",
|
|
|
|
height:"100%",
|
|
|
|
width:"100%",
|
|
|
|
backgroundColor:"rgba(0,0,0,0.5)"
|
|
|
|
}
|
|
|
|
}, _({
|
|
|
|
style:{
|
|
|
|
left: "50%",
|
|
|
|
top: "50%",
|
|
|
|
transform: "translate(-50%, -50%)",
|
|
|
|
padding: "1rem",
|
|
|
|
paddingTop: "0",
|
|
|
|
position: "absolute",
|
|
|
|
backgroundColor: "#eee",
|
2022-06-09 17:33:54 +02:00
|
|
|
minHeight: "4rem",
|
|
|
|
minWidth: "8rem",
|
|
|
|
borderRadius: "1rem",
|
|
|
|
textAlign: "center"
|
2022-06-09 17:30:40 +02:00
|
|
|
}
|
|
|
|
}, [
|
|
|
|
_({ type: "h2", style: { marginBottom: 0 }}, titel),
|
|
|
|
_({ type: "p"}, text),
|
2022-06-09 21:37:23 +02:00
|
|
|
_({ type: "button", find:"btn", event: {click: callback}, style:{
|
2022-06-09 17:30:40 +02:00
|
|
|
borderRadius:"0.5rem",
|
|
|
|
}},"OK"),
|
|
|
|
]));
|
|
|
|
}
|
|
|
|
|
|
|
|
const call = async (stear, { find, resolve, render, call }, {text,titel=""}) => {
|
|
|
|
render({titel,text,callback:()=>{
|
|
|
|
resolve();
|
|
|
|
fadeout(find.main._);
|
|
|
|
}});
|
2022-06-09 21:37:23 +02:00
|
|
|
await fadein (find.main._, 200, true);
|
|
|
|
find.btn._.focus();
|
2022-06-09 17:30:40 +02:00
|
|
|
}
|
|
|
|
|
2022-06-09 21:37:23 +02:00
|
|
|
export default new SFrame({
|
2022-06-09 17:30:40 +02:00
|
|
|
preRender, render, call
|
|
|
|
});
|