|
1 | 1 | const { root, visualization_config, visualization_plugin } = JSON.parse(document.getElementById("app").dataset.incoming); |
2 | 2 |
|
3 | | -const div = Object.assign(document.createElement("div"), { |
4 | | - style: "border: 2px solid #25537b; border-radius: 1rem; padding: 1rem" |
| 3 | +const container = Object.assign(document.createElement("div"), { |
| 4 | + style: ` |
| 5 | + font-family: sans-serif; |
| 6 | + max-width: 600px; |
| 7 | + margin: 0rem auto; |
| 8 | + line-height: 1.5; |
| 9 | + font-size: 14px; |
| 10 | + position: relative; |
| 11 | + padding: 1rem; |
| 12 | + background-image: url(${root + visualization_plugin.logo}); |
| 13 | + background-size: 10px; |
| 14 | + background-repeat: repeat; |
| 15 | + background-position: center; |
| 16 | + opacity: 0.5; |
| 17 | + ` |
5 | 18 | }); |
6 | 19 |
|
7 | | -const img = Object.assign(document.createElement("img"), { |
8 | | - src: root + visualization_plugin.logo, |
9 | | - style: "height: 3rem" |
| 20 | +const content = Object.assign(document.createElement("div"), { |
| 21 | + style: "position: relative; z-index: 1; background: rgba(255, 255, 255, 0.9); padding: 1rem; border-radius: 0.5rem; word-wrap: break-word; overflow-wrap: break-word; word-break: break-all;" |
10 | 22 | }); |
11 | | -div.appendChild(img); |
| 23 | + |
| 24 | +const dataset = Object.assign(document.createElement("div"), { |
| 25 | + innerText: `You have selected dataset: ${visualization_config.dataset_id}`, |
| 26 | + style: "margin-bottom: 1rem; font-weight: 600;" |
| 27 | +}); |
| 28 | +content.appendChild(dataset); |
12 | 29 |
|
13 | 30 | Object.entries(visualization_plugin).forEach(([key, value]) => { |
14 | | - const row = document.createElement("div"); |
| 31 | + const row = Object.assign(document.createElement("div"), { |
| 32 | + style: "display: flex; margin-bottom: 0.25rem;" |
| 33 | + }); |
15 | 34 | const spanKey = Object.assign(document.createElement("span"), { |
16 | | - innerText: `${key}: `, |
17 | | - style: "font-weight: bold" |
| 35 | + innerText: key, |
| 36 | + style: "font-weight: 600; width: 150px; flex-shrink: 0;" |
18 | 37 | }); |
19 | 38 | const spanValue = Object.assign(document.createElement("span"), { |
20 | | - innerText: JSON.stringify(value) |
| 39 | + innerText: JSON.stringify(value), |
| 40 | + style: "color: #444;" |
21 | 41 | }); |
22 | 42 | row.appendChild(spanKey); |
23 | 43 | row.appendChild(spanValue); |
24 | | - div.appendChild(row); |
25 | | -}); |
26 | | - |
27 | | -const dataset = Object.assign(document.createElement("div"), { |
28 | | - innerText: `You have selected dataset: ${visualization_config.dataset_id}.`, |
29 | | - style: "font-weight: bold; padding-top: 1rem;" |
| 44 | + content.appendChild(row); |
30 | 45 | }); |
31 | | -div.appendChild(dataset); |
32 | 46 |
|
33 | | -document.body.appendChild(div); |
| 47 | +container.appendChild(content); |
| 48 | +document.body.appendChild(container); |
0 commit comments