refactor: new widget UX

This commit is contained in:
Tristan Yang
2022-11-11 11:42:20 +08:00
parent 46a4e150e6
commit 821c1d1112
23 changed files with 1155 additions and 1643 deletions
+11 -9
View File
@@ -1,21 +1,23 @@
const {
origin = location.origin,
hostId = 1,
closeWidth = 52,
closeHeight = 52,
openWidth = 600,
openHeight = 800
closeWidth = 48,
closeHeight = 48,
openWidth = 380,
openHeight = 680
} = document.currentScript.dataset;
const _src = document.currentScript.src;
const wrapper = document.createElement("iframe");
const styles = {
position: "fixed",
right: "15px",
bottom: "15px",
borderRadius: "8px",
right: "16px",
bottom: "16px",
border: "none",
zIndex: 9999
zIndex: 9999,
boxShadow: `rgb(0 0 0 / 25%) 0px 25px 50px -12px`
};
Object.assign(wrapper.style, styles);
wrapper.src = `${origin}/widget.html?host=${hostId}`;
wrapper.src = `${new URL(_src).origin}/widget.html?host=${hostId}`;
wrapper.width = closeWidth;
wrapper.height = closeHeight;
wrapper.frameborder = 0;