-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSmartPhone.js
More file actions
31 lines (27 loc) · 1.22 KB
/
SmartPhone.js
File metadata and controls
31 lines (27 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const plugin = ({widgets, simulator, vehicle}) => {
const container = document.createElement("div")
container.setAttribute("style", `height: 100%; width: 100%;`)
container.innerHTML = (`
<div style="max-width: fit-content; margin: 0 auto; position: relative;">
<img src="https://firebasestorage.googleapis.com/v0/b/digital-auto.appspot.com/o/media%2FDashboardPhone.png?alt=media&token=d361018a-b4b3-42c0-8ef0-16c9e70fd9c7" style="height: 100%; width: 100%; object-fit: contain;">
<div class="smartphone-text" style="position: absolute; color: white; font-family: 'Lato'; width: 100%; top: 0; height: 100%; box-sizing: border-box; padding-top: 25px; padding-right: 12px; padding-left: 12px; padding-bottom: 25px;"></div>
</div>
`)
let boxGlobal = null
widgets.register("Image", (box) => {
boxGlobal = box
box.injectNode(container)
return () => {
boxGlobal = null
// Deactivation function for clearing intervals or such.
}
})
return {
set_text: (text) => {
if (boxGlobal !== null) {
container.querySelector(".smartphone-text").textContent = text
}
}
}
}
export default plugin