Skip to content

Commit 52d0b33

Browse files
committed
pass theme and coordinate visibility
1 parent 84254dc commit 52d0b33

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

client/modules/IDE/actions/ide.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,8 @@ export function startSketch() {
260260
files: state.files,
261261
basePath: window.location.pathname,
262262
gridOutput: state.preferences.gridOutput,
263-
textOutput: state.preferences.textOutput
263+
textOutput: state.preferences.textOutput,
264+
userTheme: state.preferences.theme
264265
}
265266
});
266267
dispatchMessage({

client/modules/Preview/previewIndex.jsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ const App = () => {
2727
const [basePath, setBasePath] = useState('');
2828
const [textOutput, setTextOutput] = useState(false);
2929
const [gridOutput, setGridOutput] = useState(false);
30-
const [coordinatesVisible] = useState(true);
30+
const [userTheme, setUserTheme] = useState('light');
31+
const [coordinatesVisible, setCoordinatesVisible] = useState(false);
3132

3233
const { updateCoordinates } = useCoordinates();
3334

@@ -41,6 +42,7 @@ const App = () => {
4142
setBasePath(payload.basePath);
4243
setTextOutput(payload.textOutput);
4344
setGridOutput(payload.gridOutput);
45+
setUserTheme(payload.userTheme);
4446
break;
4547
case MessageTypes.START:
4648
setIsPlaying(true);
@@ -57,6 +59,9 @@ const App = () => {
5759
case MessageTypes.COORDINATES:
5860
updateCoordinates(payload);
5961
break;
62+
case MessageTypes.COORDINATES_VISIBILITY:
63+
setCoordinatesVisible(payload);
64+
break;
6065
default:
6166
break;
6267
}
@@ -88,9 +93,9 @@ const App = () => {
8893
}, []);
8994

9095
return (
91-
<ThemeProvider theme={theme}>
96+
<ThemeProvider theme={theme[userTheme]}>
9297
<GlobalStyle />
93-
{coordinatesVisible && <CoordinateTracker coordinates />}
98+
{coordinatesVisible && <CoordinateTracker />}
9499
<EmbedFrame
95100
files={memoizedFiles}
96101
isPlaying={isPlaying}

client/utils/dispatcher.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ export const MessageTypes = {
1212
SKETCH: 'SKETCH',
1313
REGISTER: 'REGISTER',
1414
EXECUTE: 'EXECUTE',
15-
COORDINATES: 'COORDINATES'
15+
COORDINATES: 'COORDINATES',
16+
COORDINATES_VISIBILITY: 'COORDINATES_VISIBILITY'
1617
};
1718

1819
export function registerFrame(newFrame, newOrigin) {

0 commit comments

Comments
 (0)