Skip to content

Commit 91d95d3

Browse files
committed
fix: code editor output on dark mode
also fixed todo cards color in light mode
1 parent 021b116 commit 91d95d3

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

public/sandbox.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,12 @@
3333
#holder{
3434
position: relative;
3535
}
36+
.dark{
37+
color : #fff;
38+
}
3639
</style>
3740
</head>
38-
<body>
41+
<body id="body">
3942

4043
<div id="holder">
4144
<div class="language-javascript" id="editor"></div>

public/script.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
const urlSearchParams = new URLSearchParams(window.location.search);
2+
const params = Object.fromEntries(urlSearchParams.entries());
3+
if(params.theme === "dark"){
4+
document.getElementById("body").classList.remove('light');
5+
document.getElementById("body").classList.add('dark');
6+
}else{
7+
document.getElementById("body").classList.remove('dark');
8+
document.getElementById("body").classList.add('light');
9+
}
10+
111
hljs.configure({ ignoreUnescapedHTML: true })
212
const jar = CodeJar(document.querySelector('#editor'), hljs.highlightElement, { tab: '\t' });
313
jar.updateCode(`console.log("Hello there!")`)

src/App.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
color: black;
131131
}
132132

133-
.react-kanban-card {
133+
.dark .react-kanban-card {
134134
backdrop-filter: blur(16px) saturate(180%);
135135
-webkit-backdrop-filter: blur(16px) saturate(180%);
136136
background-color: rgba(17, 25, 40, 0);
@@ -143,7 +143,7 @@
143143
}
144144

145145
@media (max-width: 1400px) {
146-
.react-kanban-card, .react-kanban-card-adder-form, .react-kanban-card-skeleton {
146+
.dark .react-kanban-card, .react-kanban-card-adder-form, .react-kanban-card-skeleton {
147147
border: 2px;
148148
background-color: black;
149149
box-sizing: border-box;

src/components/sandbox.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
import { useApp } from "./context/appContext"
2+
13
const Sandbox = () => {
2-
return <iframe style={{minHeight : 600, width : "100%"}} src="sandbox.html" />
4+
const {theme } = useApp()
5+
return <iframe style={{minHeight : 600, width : "100%"}} src={`sandbox.html?theme=${theme}`} />
36
}
47

58
export default Sandbox

0 commit comments

Comments
 (0)