Skip to content

Commit ed00f9a

Browse files
fix: CHARTS-4414 change the background color to match tha chart's background color in dark mode (#30)
1 parent f5a5a6c commit ed00f9a

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

examples/unauthenticated/assets/styles.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ span {
7575
}
7676

7777
.dark-mode {
78-
background-color: #061621;
78+
background-color: #21313c; /* to match the chart's background */
7979
color: #ffffff;
8080
}
8181

examples/unauthenticated/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99
},
1010
"dependencies": {
1111
"@mongodb-js/charts-embed-dom": "^2.0.1",
12-
"regenerator-runtime": "^0.13.3",
1312
"parcel": "^1.12.4"
1413
},
1514
"devDependencies": {
1615
"@babel/core": "^7.8.4",
1716
"@babel/preset-env": "^7.8.4",
1817
"parcel-bundler": "^1.6.1"
1918
},
20-
"keywords": []
19+
"keywords": [],
20+
"browserslist": [
21+
"since 2020"
22+
]
2123
}

examples/unauthenticated/src/index.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
import "regenerator-runtime/runtime";
21
import ChartsEmbedSDK from "@mongodb-js/charts-embed-dom";
32

43
const sdk = new ChartsEmbedSDK({
5-
baseUrl: "https://charts.mongodb.com/charts-embedding-examples-wgffp" // Optional: ~REPLACE~ with the Base URL from your Embed Chart dialog
4+
baseUrl: "https://charts.mongodb.com/charts-embedding-examples-wgffp", // Optional: ~REPLACE~ with the Base URL from your Embed Chart dialog
65
});
76

87
const chart = sdk.createChart({
98
chartId: "735cfa75-15b8-483a-bc2e-7c6659511c7c", // Optional: ~REPLACE~ with the Chart ID from your Embed Chart dialog
10-
height: "700px"
9+
height: "700px",
1110
});
1211

1312
async function renderChart() {
@@ -33,7 +32,7 @@ async function renderChart() {
3332
*/
3433
document
3534
.getElementById("refresh-interval")
36-
.addEventListener("change", async e => {
35+
.addEventListener("change", async (e) => {
3736
var refreshInterval = e.target.value;
3837
refreshInterval
3938
? chart.setRefreshInterval(Number(refreshInterval))
@@ -58,7 +57,7 @@ async function renderChart() {
5857
*/
5958
document
6059
.getElementById("country-filter")
61-
.addEventListener("change", async e => {
60+
.addEventListener("change", async (e) => {
6261
const country = e.target.value;
6362
const currentFilterDOM = document.getElementById("currentFilter");
6463
if (country) {
@@ -84,7 +83,7 @@ async function renderChart() {
8483
*/
8584
document
8685
.getElementById("themeSwitch")
87-
.addEventListener("change", async function() {
86+
.addEventListener("change", async function () {
8887
if (this.checked) {
8988
await chart.setTheme("dark");
9089
document.body.classList.toggle("dark-mode", true);
@@ -98,4 +97,4 @@ async function renderChart() {
9897
});
9998
}
10099

101-
renderChart().catch(e => window.alert(e.message));
100+
renderChart().catch((e) => window.alert(e.message));

0 commit comments

Comments
 (0)