Skip to content

Commit 74816d7

Browse files
committed
EditorPage: tiny WB improvements for JSON mode and viewport resizer alignments
1 parent 91ae73e commit 74816d7

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

packages/perseus-editor/src/editor-page.tsx

+23-13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import {components, ApiOptions, ClassNames} from "@khanacademy/perseus";
2+
import {View} from "@khanacademy/wonder-blocks-core";
3+
import {Checkbox} from "@khanacademy/wonder-blocks-form";
4+
import {spacing} from "@khanacademy/wonder-blocks-tokens";
25
import * as React from "react";
36
import invariant from "tiny-invariant";
47
import _ from "underscore";
@@ -180,19 +183,21 @@ class EditorPage extends React.Component<Props, State> {
180183

181184
return (
182185
<div id="perseus" className={className}>
183-
<div style={{marginBottom: 10}}>
186+
<View
187+
style={{
188+
marginBottom: 10,
189+
height: 30,
190+
flexDirection: "row",
191+
gap: spacing.medium_16,
192+
alignItems: "center",
193+
}}
194+
>
184195
{this.props.developerMode && (
185-
<span>
186-
<label>
187-
{" "}
188-
Developer JSON Mode:{" "}
189-
<input
190-
type="checkbox"
191-
checked={this.props.jsonMode}
192-
onChange={this.toggleJsonMode}
193-
/>
194-
</label>{" "}
195-
</span>
196+
<Checkbox
197+
label="Developer JSON Mode"
198+
checked={this.props.jsonMode}
199+
onChange={this.toggleJsonMode}
200+
/>
196201
)}
197202

198203
{!this.props.jsonMode && (
@@ -205,6 +210,11 @@ class EditorPage extends React.Component<Props, State> {
205210
)}
206211

207212
{!this.props.jsonMode && (
213+
// NOTE: This component positions itself using fixed
214+
// positioning, so even though it appears here, near
215+
// the JSON Mode and Viewport Resizer elements, it
216+
// shows up in a completely different place on the page
217+
// visually.
208218
<HUD
209219
message="Style warnings"
210220
enabled={this.state.highlightLint}
@@ -215,7 +225,7 @@ class EditorPage extends React.Component<Props, State> {
215225
}}
216226
/>
217227
)}
218-
</div>
228+
</View>
219229

220230
{this.props.developerMode && this.props.jsonMode && (
221231
<div>

0 commit comments

Comments
 (0)